From afd410387a00a60a66a74356760ec604015ae45c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Fild=C3=A1n?= Date: Sun, 21 Jun 2026 22:44:48 +0200 Subject: [PATCH 1/7] Update buildscript --- build.gradle.kts | 72 ++++++++++--------- .../net/fabricmc/loom/util/GroovyXmlUtil.java | 4 +- gradle.properties | 4 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 4 files changed, 42 insertions(+), 40 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index c206c5669..30b92abee 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,8 +5,8 @@ import net.modificationstation.stationapi.gradle.SubprojectHelpers.addDependency plugins { id("maven-publish") - id("fabric-loom") version "1.9-SNAPSHOT" - id("babric-loom-extension") version "1.9.2" + id("fabric-loom") version "1.16.2" + id("babric-loom-extension") version "1.16.1" } // https://stackoverflow.com/a/40101046 - Even with kotlin, gradle can't get it's shit together. @@ -19,9 +19,13 @@ allprojects { apply(plugin = "fabric-loom") apply(plugin = "babric-loom-extension") - java.sourceCompatibility = JavaVersion.VERSION_17 - java.targetCompatibility = JavaVersion.VERSION_17 - + java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(17)) + } + withSourcesJar() + } + repositories { maven(url = "https://maven.minecraftforge.net/") maven(url = "https://maven.glass-launcher.net/babric") @@ -47,15 +51,13 @@ allprojects { } } - @Suppress("UnstableApiUsage") configurations { - create("transitiveImplementation") - - // Required cause loom 0.14 for some reason doesn't remove asm-all 4.1. Ew. - all { - exclude(group = "org.ow2.asm", module = "asm-debug-all") - exclude(group = "org.ow2.asm", module = "asm-all") - exclude(group = "babric") + listOf("transitiveImplementation", "modImplementation").forEach { name -> + named(name) { + exclude(group = "org.ow2.asm", module = "asm-debug-all") + exclude(group = "org.ow2.asm", module = "asm-all") + exclude(group = "babric", module = "fabric-loader") + } } } @@ -74,15 +76,15 @@ allprojects { modImplementation("net.fabricmc:fabric-loader:${project.properties["loader_version"]}") - "transitiveImplementation"(implementation("org.apache.commons:commons-lang3:3.12.0") as Dependency) - "transitiveImplementation"(implementation("commons-io:commons-io:2.11.0") as Dependency) - "transitiveImplementation"(implementation("net.jodah:typetools:${project.properties["typetools_version"]}") as Dependency) - "transitiveImplementation"(implementation("com.github.mineLdiver:UnsafeEvents:${project.properties["unsafeevents_version"]}") as Dependency) - "transitiveImplementation"(implementation("it.unimi.dsi:fastutil:${project.properties["fastutil_version"]}") as Dependency) - "transitiveImplementation"(implementation("com.github.ben-manes.caffeine:caffeine:${project.properties["caffeine_version"]}") as Dependency) - "transitiveImplementation"(implementation("com.mojang:datafixerupper:${project.properties["dfu_version"]}") as Dependency) - "transitiveImplementation"(implementation("maven.modrinth:spasm:${project.properties["spasm_version"]}") as Dependency) - "transitiveImplementation"(implementation("me.carleslc:Simple-Yaml:1.8.4") as Dependency) + transitiveImplementation(implementation("org.apache.commons:commons-lang3:3.12.0") as Dependency) + transitiveImplementation(implementation("commons-io:commons-io:2.11.0") as Dependency) + transitiveImplementation(implementation("net.jodah:typetools:${project.properties["typetools_version"]}") as Dependency) + transitiveImplementation(implementation("com.github.mineLdiver:UnsafeEvents:${project.properties["unsafeevents_version"]}") as Dependency) + transitiveImplementation(implementation("it.unimi.dsi:fastutil:${project.properties["fastutil_version"]}") as Dependency) + transitiveImplementation(implementation("com.github.ben-manes.caffeine:caffeine:${project.properties["caffeine_version"]}") as Dependency) + transitiveImplementation(implementation("com.mojang:datafixerupper:${project.properties["dfu_version"]}") as Dependency) + transitiveImplementation(implementation("maven.modrinth:spasm:${project.properties["spasm_version"]}") as Dependency) + transitiveImplementation(implementation("me.carleslc:Simple-Yaml:1.8.4") as Dependency) // not a runtime dependency unless we use something outside its events. modImplementation("net.glasslauncher.mods:GlassConfigAPI:${project.properties["gcapi_version"]}") @@ -97,7 +99,7 @@ allprojects { // adds some useful annotations for miscellaneous uses. does not add any dependencies, though people without the lib will be missing some useful context hints. implementation("org.jetbrains:annotations:23.0.0") - modLocalRuntime("net.glasslauncher.mods:ModMenu:${project.properties["modmenu_version"]}") + modLocalRuntime("net.danygames2014:modmenu:${project.properties["modmenu_version"]}") modLocalRuntime("maven.modrinth:retrocommands:${project.properties["rc_version"]}") { isTransitive = false } @@ -129,13 +131,6 @@ allprojects { } } - java { - // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task - // if it is present. - // If you remove this line, sources will not be generated. - withSourcesJar() - } - // Include license inside of the mod jar configure("jar") { from(rootProject.file("LICENSE")) { @@ -147,6 +142,7 @@ allprojects { // this fixes some edge cases with special characters not displaying correctly // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html tasks.withType { + options.release = 17 options.encoding = "UTF-8" } @@ -207,14 +203,15 @@ base.archivesName.set(project.properties["archives_base_name"] as String) version = (if (project.hasProperty("override_version")) (project.properties["override_version"] as String).substring(0, 7) else project.properties["mod_version"])!! subprojects { + version = rootProject.version + // This makes the older pre-releases easier to clean up. group = if (rootProject.hasProperty("override_version")) { - (project.properties["maven_group"] as String) + ".StationAPI.${(project.properties["override_version"] as String).substring(0, 7)}" + (rootProject.properties["maven_group"] as String) + ".StationAPI.${(rootProject.properties["override_version"] as String).substring(0, 7)}" + } else { + (rootProject.properties["maven_group"] as String) + ".StationAPI.submodule.$name" } - else { - (project.properties["maven_group"] as String) + ".StationAPI.submodule.${project.properties["archivesBaseName"]}" - } - + configurations { create("out") { isCanBeConsumed = true @@ -308,3 +305,8 @@ tasks.register("testJar") { tasks.withType { enabled = false } + +// Gradle 9 fails the build if there are no tests, but we are using the test package for a test mod +tasks.withType(Test::class.java) { + failOnNoDiscoveredTests = false +} \ No newline at end of file diff --git a/buildSrc/src/main/java/net/fabricmc/loom/util/GroovyXmlUtil.java b/buildSrc/src/main/java/net/fabricmc/loom/util/GroovyXmlUtil.java index 7547153ef..176fac0e9 100644 --- a/buildSrc/src/main/java/net/fabricmc/loom/util/GroovyXmlUtil.java +++ b/buildSrc/src/main/java/net/fabricmc/loom/util/GroovyXmlUtil.java @@ -25,7 +25,7 @@ package net.fabricmc.loom.util; import groovy.util.Node; -import groovy.xml.QName; +import javax.xml.namespace.QName; public final class GroovyXmlUtil { private GroovyXmlUtil() { } @@ -46,7 +46,7 @@ private static boolean isSameName(Object nodeName, String givenName) { } if (nodeName instanceof QName qName) { - return qName.matches(givenName); + return qName.getLocalPart().equals(givenName); } // New groovy 3 (gradle 7) class diff --git a/gradle.properties b/gradle.properties index 57c5e5a38..b0718f49b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,7 +11,7 @@ fabric.loom.multiProjectOptimisation=true # check these on https://fabricmc.net/use minecraft_version = b1.7.3 yarn_mappings = b1.7.3+e1fe071 - loader_version = 0.16.9 + loader_version = 0.19.3 # Library Properties typetools_version = 0.8.3 @@ -28,5 +28,5 @@ fabric.loom.multiProjectOptimisation=true # Test properties gcapi_version = 3.2.5 - modmenu_version = 1.8.5-beta.11 + modmenu_version = 1.1.1 rc_version = 0.5.4 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e18bc253b..5dd3c0121 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From d39f0c38dd391988d63e07bf1698deaf566c45c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Fild=C3=A1n?= Date: Sun, 21 Jun 2026 22:45:03 +0200 Subject: [PATCH 2/7] AMI Compat in dev --- build.gradle.kts | 9 +++ gradle.properties | 3 +- .../mixin/StationRecipesMixinPlugin.java | 71 +++++++++++++++++++ .../recipe/dev/StationShapedRecipeMixin.java | 19 +++++ .../dev/StationShapelessRecipeMixin.java | 19 +++++ .../resources/station-recipes-v0.mixins.json | 1 + 6 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 station-recipes-v0/src/main/java/net/modificationstation/stationapi/mixin/StationRecipesMixinPlugin.java create mode 100644 station-recipes-v0/src/main/java/net/modificationstation/stationapi/mixin/recipe/dev/StationShapedRecipeMixin.java create mode 100644 station-recipes-v0/src/main/java/net/modificationstation/stationapi/mixin/recipe/dev/StationShapelessRecipeMixin.java diff --git a/build.gradle.kts b/build.gradle.kts index 30b92abee..7b30adb4a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -103,6 +103,11 @@ allprojects { modLocalRuntime("maven.modrinth:retrocommands:${project.properties["rc_version"]}") { isTransitive = false } + + // The "enableAmiCompat" program argument needs to be present in order to apply a dev-only patch for AMI to work + modLocalRuntime("net.glasslauncher.mods:AlwaysMoreItems:${project.properties["ami_version"]}") { + isTransitive = false + } annotationProcessor("io.github.llamalad7:mixinextras-fabric:0.4.1") @@ -292,6 +297,10 @@ loom { source("test") server() } + + configureEach { + programArgs("enableAmiCompat") + } } } diff --git a/gradle.properties b/gradle.properties index b0718f49b..b13530acf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -29,4 +29,5 @@ fabric.loom.multiProjectOptimisation=true # Test properties gcapi_version = 3.2.5 modmenu_version = 1.1.1 - rc_version = 0.5.4 \ No newline at end of file + rc_version = 0.5.4 + ami_version = 1.10.0 \ No newline at end of file diff --git a/station-recipes-v0/src/main/java/net/modificationstation/stationapi/mixin/StationRecipesMixinPlugin.java b/station-recipes-v0/src/main/java/net/modificationstation/stationapi/mixin/StationRecipesMixinPlugin.java new file mode 100644 index 000000000..f7724fbf4 --- /dev/null +++ b/station-recipes-v0/src/main/java/net/modificationstation/stationapi/mixin/StationRecipesMixinPlugin.java @@ -0,0 +1,71 @@ +package net.modificationstation.stationapi.mixin; + +import net.fabricmc.loader.api.FabricLoader; +import net.modificationstation.stationapi.api.StationAPI; +import org.objectweb.asm.tree.ClassNode; +import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; +import org.spongepowered.asm.mixin.extensibility.IMixinInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +public class StationRecipesMixinPlugin implements IMixinConfigPlugin { + @Override + public void onLoad(String mixinPackage) { + + } + + @Override + public String getRefMapperConfig() { + return null; + } + + @Override + public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { + return true; + } + + @Override + public void acceptTargets(Set myTargets, Set otherTargets) { + + } + + @Override + public List getMixins() { + if (FabricLoader.getInstance().isDevelopmentEnvironment() && FabricLoader.getInstance().isModLoaded("alwaysmoreitems")) { + boolean enableAmiCompat = false; + + String[] launchArgs = FabricLoader.getInstance().getLaunchArguments(true); + for (String arg : launchArgs) { + if (arg.contains("enableAmiCompat")) { + enableAmiCompat = true; + break; + } + } + + if (!enableAmiCompat) { + return null; + } + + StationAPI.LOGGER.info("AlwaysMoreItems detected in development environment, adding mixins to make it work"); + + ArrayList mixins = new ArrayList<>(); + mixins.add("dev.StationShapedRecipeMixin"); + mixins.add("dev.StationShapelessRecipeMixin"); + return mixins; + } + + return null; + } + + @Override + public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { + + } + + @Override + public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { + + } +} diff --git a/station-recipes-v0/src/main/java/net/modificationstation/stationapi/mixin/recipe/dev/StationShapedRecipeMixin.java b/station-recipes-v0/src/main/java/net/modificationstation/stationapi/mixin/recipe/dev/StationShapedRecipeMixin.java new file mode 100644 index 000000000..3ef5b31bd --- /dev/null +++ b/station-recipes-v0/src/main/java/net/modificationstation/stationapi/mixin/recipe/dev/StationShapedRecipeMixin.java @@ -0,0 +1,19 @@ +package net.modificationstation.stationapi.mixin.recipe.dev; + +import net.minecraft.item.ItemStack; +import net.modificationstation.stationapi.impl.recipe.StationShapedRecipe; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; + +@SuppressWarnings("UnusedMixin") // Added in a mixin plugin only in development environment with AlwaysMoreItems present +@Mixin(StationShapedRecipe.class) +public abstract class StationShapedRecipeMixin { + @Shadow + public abstract ItemStack getOutput(); + + @Unique + public ItemStack method_2073() { + return this.getOutput(); + } +} diff --git a/station-recipes-v0/src/main/java/net/modificationstation/stationapi/mixin/recipe/dev/StationShapelessRecipeMixin.java b/station-recipes-v0/src/main/java/net/modificationstation/stationapi/mixin/recipe/dev/StationShapelessRecipeMixin.java new file mode 100644 index 000000000..4f2701c23 --- /dev/null +++ b/station-recipes-v0/src/main/java/net/modificationstation/stationapi/mixin/recipe/dev/StationShapelessRecipeMixin.java @@ -0,0 +1,19 @@ +package net.modificationstation.stationapi.mixin.recipe.dev; + +import net.minecraft.item.ItemStack; +import net.modificationstation.stationapi.impl.recipe.StationShapelessRecipe; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; + +@SuppressWarnings("UnusedMixin") // Added in a mixin plugin only in development environment with AlwaysMoreItems present +@Mixin(StationShapelessRecipe.class) +public abstract class StationShapelessRecipeMixin { + @Shadow + public abstract ItemStack getOutput(); + + @Unique + public ItemStack method_2073() { + return this.getOutput(); + } +} diff --git a/station-recipes-v0/src/main/resources/station-recipes-v0.mixins.json b/station-recipes-v0/src/main/resources/station-recipes-v0.mixins.json index cb789d3bc..ea2816a23 100644 --- a/station-recipes-v0/src/main/resources/station-recipes-v0.mixins.json +++ b/station-recipes-v0/src/main/resources/station-recipes-v0.mixins.json @@ -3,6 +3,7 @@ "minVersion": "0.8", "package": "net.modificationstation.stationapi.mixin.recipe", "compatibilityLevel": "JAVA_17", + "plugin": "net.modificationstation.stationapi.mixin.StationRecipesMixinPlugin", "mixins": [ "CraftingRecipeManagerMixin", "CraftingResultMixin", From 3f2d9a28068044914b9fc33f6e574dd51a42aa90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Fild=C3=A1n?= Date: Sun, 21 Jun 2026 22:54:15 +0200 Subject: [PATCH 3/7] Turns out newer Loom is out --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 7b30adb4a..121802d77 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ import net.modificationstation.stationapi.gradle.SubprojectHelpers.addDependency plugins { id("maven-publish") - id("fabric-loom") version "1.16.2" + id("fabric-loom") version "1.17.12" id("babric-loom-extension") version "1.16.1" } From 7ccf80784387bbaa2ec3aedab8c20474ad72e8ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Fild=C3=A1n?= Date: Sun, 21 Jun 2026 23:32:24 +0200 Subject: [PATCH 4/7] Formatting --- build.gradle.kts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 121802d77..2a68aeaa0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -25,7 +25,7 @@ allprojects { } withSourcesJar() } - + repositories { maven(url = "https://maven.minecraftforge.net/") maven(url = "https://maven.glass-launcher.net/babric") @@ -103,7 +103,7 @@ allprojects { modLocalRuntime("maven.modrinth:retrocommands:${project.properties["rc_version"]}") { isTransitive = false } - + // The "enableAmiCompat" program argument needs to be present in order to apply a dev-only patch for AMI to work modLocalRuntime("net.glasslauncher.mods:AlwaysMoreItems:${project.properties["ami_version"]}") { isTransitive = false @@ -209,14 +209,14 @@ version = (if (project.hasProperty("override_version")) (project.properties["ove subprojects { version = rootProject.version - + // This makes the older pre-releases easier to clean up. group = if (rootProject.hasProperty("override_version")) { (rootProject.properties["maven_group"] as String) + ".StationAPI.${(rootProject.properties["override_version"] as String).substring(0, 7)}" } else { (rootProject.properties["maven_group"] as String) + ".StationAPI.submodule.$name" } - + configurations { create("out") { isCanBeConsumed = true From cc293b0218f290cf4d3a23097fa2eb4625d8fc3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Fild=C3=A1n?= Date: Sun, 21 Jun 2026 23:33:38 +0200 Subject: [PATCH 5/7] Redundant --- build.gradle.kts | 1 - 1 file changed, 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 2a68aeaa0..161092312 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -147,7 +147,6 @@ allprojects { // this fixes some edge cases with special characters not displaying correctly // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html tasks.withType { - options.release = 17 options.encoding = "UTF-8" } From de77a17af94528ec87f1a81ae7bed92867083638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Fild=C3=A1n?= Date: Sun, 21 Jun 2026 23:33:43 +0200 Subject: [PATCH 6/7] So this is how kotlin does it, I see --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 161092312..bfc3c0ad7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -315,6 +315,6 @@ tasks.withType { } // Gradle 9 fails the build if there are no tests, but we are using the test package for a test mod -tasks.withType(Test::class.java) { +tasks.withType { failOnNoDiscoveredTests = false } \ No newline at end of file From 49ecc5925d15e26831992e14f50b8e3847ca3af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Fild=C3=A1n?= Date: Sun, 21 Jun 2026 23:33:57 +0200 Subject: [PATCH 7/7] Early return --- .../mixin/StationRecipesMixinPlugin.java | 47 ++++++++++--------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/station-recipes-v0/src/main/java/net/modificationstation/stationapi/mixin/StationRecipesMixinPlugin.java b/station-recipes-v0/src/main/java/net/modificationstation/stationapi/mixin/StationRecipesMixinPlugin.java index f7724fbf4..481fa44e1 100644 --- a/station-recipes-v0/src/main/java/net/modificationstation/stationapi/mixin/StationRecipesMixinPlugin.java +++ b/station-recipes-v0/src/main/java/net/modificationstation/stationapi/mixin/StationRecipesMixinPlugin.java @@ -13,7 +13,7 @@ public class StationRecipesMixinPlugin implements IMixinConfigPlugin { @Override public void onLoad(String mixinPackage) { - + } @Override @@ -33,30 +33,33 @@ public void acceptTargets(Set myTargets, Set otherTargets) { @Override public List getMixins() { - if (FabricLoader.getInstance().isDevelopmentEnvironment() && FabricLoader.getInstance().isModLoaded("alwaysmoreitems")) { - boolean enableAmiCompat = false; - - String[] launchArgs = FabricLoader.getInstance().getLaunchArguments(true); - for (String arg : launchArgs) { - if (arg.contains("enableAmiCompat")) { - enableAmiCompat = true; - break; - } - } + if (!FabricLoader.getInstance().isDevelopmentEnvironment()) { + return null; + } + + if (FabricLoader.getInstance().isModLoaded("alwaysmoreitems")) { + return null; + } - if (!enableAmiCompat) { - return null; + boolean enableAmiCompat = false; + String[] launchArgs = FabricLoader.getInstance().getLaunchArguments(true); + for (String arg : launchArgs) { + if (arg.contains("enableAmiCompat")) { + enableAmiCompat = true; + break; } - - StationAPI.LOGGER.info("AlwaysMoreItems detected in development environment, adding mixins to make it work"); - - ArrayList mixins = new ArrayList<>(); - mixins.add("dev.StationShapedRecipeMixin"); - mixins.add("dev.StationShapelessRecipeMixin"); - return mixins; } - - return null; + + if (!enableAmiCompat) { + return null; + } + + StationAPI.LOGGER.info("AlwaysMoreItems detected in development environment, adding mixins to make it work"); + + ArrayList mixins = new ArrayList<>(); + mixins.add("dev.StationShapedRecipeMixin"); + mixins.add("dev.StationShapelessRecipeMixin"); + return mixins; } @Override