Skip to content

Commit

Permalink
feat: Restructure and add NeoForge
Browse files Browse the repository at this point in the history
BlayTheNinth committed Dec 8, 2023
1 parent 9bbd4db commit d57ed55
Showing 26 changed files with 554 additions and 299 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -6,5 +6,5 @@ on:

jobs:
build:
uses: TwelveIterationMods/Workflows/.github/workflows/publish-snapshot.yml@main
uses: TwelveIterationMods/Workflows/.github/workflows/build.yml@v2
secrets: inherit
3 changes: 1 addition & 2 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -11,11 +11,10 @@ on:
- major
- minor
- patch
- none

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
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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
@@ -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}" }
}
}

@@ -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()
@@ -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 {
@@ -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"
}
}
14 changes: 14 additions & 0 deletions fabric/src/main/resources/craftingtweaks.fabric.mixins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"required": true,
"minVersion": "0.8",
"package": "net.blay09.mods.craftingtweaks.fabric.mixin",
"refmap": "${mod_id}.refmap.json",
"compatibilityLevel": "JAVA_17",
"mixins": [
],
"client": [
],
"injectors": {
"defaultRequire": 1
}
}
31 changes: 17 additions & 14 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,43 @@
{
"schemaVersion": 1,
"id": "craftingtweaks",
"id": "${mod_id}",
"version": "${version}",

"name": "Crafting Tweaks",
"description": "Allows you to rotate, balance or clear the crafting matrix by the press of a button, in any (supported) crafting window.",
"name": "${mod_name}",
"description": "${description}",
"authors": [
"BlayTheNinth"
],
"contact": {
"homepage": "https://mods.twelveiterations.com/mc/craftingtweaks",
"sources": "https://github.com/TwelveIterationMods/CraftingTweaks",
"issues": "https://github.com/TwelveIterationMods/CraftingTweaks/issues"
"homepage": "${homepage}",
"sources": "${sources}",
"issues": "${issues}"
},

"license": "All Rights Reserved",
"icon": "craftingtweaks-icon.png",
"license": "${license}",
"icon": "${mod_id}.png",

"environment": "*",
"entrypoints": {
"main": [
"net.blay09.mods.craftingtweaks.FabricCraftingTweaks"
"net.blay09.mods.${mod_id}.fabric.Fabric${mod_main}"
],
"client": [
"net.blay09.mods.craftingtweaks.client.FabricCraftingTweaksClient"
"net.blay09.mods.${mod_id}.fabric.client.Fabric${mod_main}Client"
],
"modmenu": [
"net.blay09.mods.craftingtweaks.compat.ModMenuIntegration"
"net.blay09.mods.${mod_id}.fabric.compat.ModMenuIntegration"
]
},
"mixins": [
"${mod_id}.mixins.json",
"${mod_id}.fabric.mixins.json"
],

"depends": {
"balm-fabric": ">=8.0.0",
"fabricloader": ">=0.14.22",
"fabric": "*",
"fabricloader": ">=0.14",
"fabric-api": "*",
"balm-fabric": "*",
"minecraft": ">=1.20.2",
"java": ">=17"
},
Loading

0 comments on commit d57ed55

Please sign in to comment.