Skip to content

Commit

Permalink
feat: Restructure and add NeoForge
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Dec 9, 2023
1 parent 701865b commit 40cdc9f
Show file tree
Hide file tree
Showing 28 changed files with 455 additions and 317 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ on:

jobs:
build:
uses: TwelveIterationMods/Workflows/.github/workflows/build.yml@main
uses: TwelveIterationMods/Workflows/.github/workflows/build.yml@v2
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:

jobs:
create-release:
uses: TwelveIterationMods/Workflows/.github/workflows/create-release.yml@main
uses: TwelveIterationMods/Workflows/.github/workflows/create-release.yml@v2
with:
bump: ${{ github.event.inputs.bump }}
secrets: inherit
8 changes: 0 additions & 8 deletions .github/workflows/prepare-changelog.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ on:

jobs:
publish:
uses: TwelveIterationMods/Workflows/.github/workflows/publish-release.yml@main
uses: TwelveIterationMods/Workflows/.github/workflows/publish-release.yml@v2
secrets: inherit
24 changes: 0 additions & 24 deletions .github/workflows/update-versions.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ build
# other
eclipse
run
runs
logs
88 changes: 62 additions & 26 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
plugins {
id 'fabric-loom' version '1.2-SNAPSHOT' apply(false)
// id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT' apply(false) // this causes ForgeGradle to fail in reobf
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7" // this is required for VanillaGradle and NeoForge to exist in harmony
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT' apply(false)
id 'net.darkhax.curseforgegradle' version '1.1.16' apply(false)
id "com.modrinth.minotaur" version "2.+" apply(false)
}

subprojects {
apply plugin: 'java'

java.toolchain.languageVersion = JavaLanguageVersion.of(java_version)
java.withSourcesJar()
java.withJavadocJar()

tasks.withType(GenerateModuleMetadata).tap {
configureEach {
enabled = false // Do not publish dependencies in pom
}
}

configurations {
testImplementation.extendsFrom compileOnly
}

jar {
from(rootProject.file("LICENSE")) {
rename { "${it}_${mod_id}" }
}
manifest {
attributes([
"Specification-Title" : mod_id,
"Specification-Vendor" : "BlayTheNinth",
"Specification-Version" : "1",
"Specification-Version" : project.jar.archiveVersion,
"Implementation-Title" : project.name,
"Implementation-Version" : project.jar.archiveVersion,
"Implementation-Vendor" : "BlayTheNinth",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
"Implementation-Vendor" : "BlayTheNinth"
])
if (forge_mixins.toBoolean()) {
attributes([
"MixinConfigs": mod_id + ".mixins.json"
])
}
}
}

sourcesJar {
from(rootProject.file("LICENSE")) {
rename { "${it}_${mod_id}" }
}
}

Expand All @@ -55,22 +57,56 @@ subprojects {

// For WTHIT
maven { url "https://maven.bai.lol" }

// For ModMenu
maven { url "https://maven.terraformersmc.com/releases/" }
}

tasks.withType(JavaCompile).configureEach {
it.options.encoding = 'UTF-8'
it.options.release = java_version as int
it.options.getRelease().set(java_version.toInteger())
}

tasks.withType(Javadoc).tap {
configureEach {
failOnError false
}
tasks.withType(Javadoc).configureEach {
failOnError false
}

if (balm_version.endsWith("SNAPSHOT")) {
configurations.configureEach {
resolutionStrategy.cacheChangingModulesFor 10, 'minutes'
processResources {
def expandProps = [
"version": version,
"group": project.group, //Else we target the task's group.
"minecraft_version": minecraft_version,
"forge_version": forge_version,
"forge_loader_version_range": forge_loader_version_range,
"forge_version_range": forge_version_range,
"minecraft_version_range": minecraft_version_range,
"fabric_version": fabric_version,
"fabric_loader_version": fabric_loader_version,
"mod_name": mod_name,
"mod_main": mod_main,
"mod_id": mod_id,
"homepage": homepage,
"issues": issues,
"sources": sources,
"license": license,
"description": project.description,
"neoforge_version": neoforge_version,
"neoforge_version_range": neoforge_version_range,
"neoforge_loader_version_range": neoforge_loader_version_range,
"balm_version_range": balm_version_range,
"pack_format_number": pack_format_number
]

filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/mods.toml', '*.mixins.json']) {
expand expandProps
}
inputs.properties(expandProps)
}

// Disables Gradle's custom module metadata from being published to maven. The
// metadata includes mapped dependencies which are not reasonably consumable by
// other mod developers.
tasks.withType(GenerateModuleMetadata).configureEach {
enabled = false
}
}
73 changes: 29 additions & 44 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,49 +1,43 @@
plugins {
id 'fabric-loom' version '1.2-SNAPSHOT'
id 'fabric-loom'
id 'maven-publish'
id 'idea'
id 'net.darkhax.curseforgegradle' version '1.0.14'
id "com.modrinth.minotaur" version "2.+"
id 'net.darkhax.curseforgegradle'
id "com.modrinth.minotaur"
}

group = mod_group
archivesBaseName = "${mod_id}-fabric-${minecraft_version}"
version = mod_version
base {
archivesName = "${mod_id}-fabric-${minecraft_version}"
}

dependencies {
minecraft "com.mojang:minecraft:${minecraft_version}"
mappings loom.officialMojangMappings()

modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
implementation project(":shared")

modImplementation("net.blay09.mods:balm-fabric:${balm_version}") {
transitive = false
changing = balm_version.endsWith("SNAPSHOT")
}

compileOnly "org.jetbrains:annotations:22.0.0"
implementation project(":shared")

compileOnly "org.jetbrains:annotations:22.0.0"
}

modCompileOnly "curse.maven:modmenu-308702:$modmenu_version"
apply from: 'dependencies.gradle'

modCompileOnly "mezz.jei:jei-$jei_minecraft_version-fabric-api:$jei_version"
if (jei_minecraft_version == minecraft_version) {
modRuntimeOnly "mezz.jei:jei-$jei_minecraft_version-fabric:$jei_version"
loom {
if (project(":shared").file("src/main/resources/${mod_id}.accesswidener").exists()) {
accessWidenerPath.set(project(":shared").file("src/main/resources/${mod_id}.accesswidener"))
}

modCompileOnly("me.shedaniel:RoughlyEnoughItems-api:$rei_version") {
transitive = false
mixin {
defaultRefmapName.set("${mod_id}.refmap.json")
}

modCompileOnly "curse.maven:jade-324717:$jade_forge_version"
modCompileOnly "mcp.mobius.waila:wthit-api:mojmap-$wthit_version"
}

apply from: 'dependencies.gradle'

loom {
runs {
client {
client()
Expand All @@ -70,31 +64,20 @@ loom {
}
}

sourceSets {
main {
resources {
srcDirs 'src/generated/resources'
}
}
}

processResources {
from project(":shared").sourceSets.main.resources
inputs.property "version", project.version

filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
sourceSets.main.resources.srcDir('src/generated/resources')

tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
source(project(":shared").sourceSets.main.allSource)
}
tasks.withType(Javadoc).configureEach {
source(project(":shared").sourceSets.main.allJava)
}
tasks.named("sourcesJar", Jar) {
from(project(":shared").sourceSets.main.allSource)
}

jar {
from(rootProject.file("LICENSE")) {
rename { "${it}_${mod_id}" }
}
processResources {
from project(":shared").sourceSets.main.resources
}

publishing {
Expand Down Expand Up @@ -127,22 +110,24 @@ task curseforge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) {

def mainFile = upload(curseforge_fabric_project_id, file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar"))
mainFile.changelog = rootProject.file('CHANGELOG.md').text
mainFile.addRequirement("fabric-api")
mainFile.addRequirement("balm-fabric")
project.minecraft_versions.split(',').toList().each { mainFile.addGameVersion(it) }
mainFile.releaseType = "release"
}

modrinth {
token = project.findProperty("modrinth.token") ?: System.getenv("MODRINTH_TOKEN") ?: "none"
projectId = project.modrinth_fabric_project_id
projectId = project.modrinth_project_id
versionType = project.modrinth_release_type
versionNumber = project.version + "+fabric-" + project.minecraft_version
uploadFile = remapJar
changelog = rootProject.file("CHANGELOG.md").text
gameVersions = project.minecraft_versions.split(',').toList()
syncBodyFrom = rootProject.file("modrinth.md").text
syncBodyFrom = rootProject.file("modpage.md").text
loaders = ['fabric']
dependencies {
required.project "fabric-api"
required.project "balm"
}
}
1 change: 1 addition & 0 deletions fabric/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dependencies {
modCompileOnly "com.terraformersmc:modmenu:$modmenu_version"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.blay09.mods.prettybeaches;
package net.blay09.mods.prettybeaches.fabric;

import net.blay09.mods.balm.api.Balm;
import net.blay09.mods.prettybeaches.PrettyBeaches;
import net.fabricmc.api.ModInitializer;

public class FabricPrettyBeaches implements ModInitializer {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.blay09.mods.prettybeaches.client;
package net.blay09.mods.prettybeaches.fabric.client;

import net.fabricmc.api.ClientModInitializer;

Expand Down
Loading

0 comments on commit 40cdc9f

Please sign in to comment.