From cf3f09715df7b0d8b37779c64f507d2339b104ad Mon Sep 17 00:00:00 2001 From: enjarai Date: Fri, 31 May 2024 09:01:23 +0200 Subject: [PATCH] Quite good --- CHANGELOG.md | 5 +- build.gradle | 71 ++++++++++++++++++- gradle.properties | 20 ++++-- .../java/nl/enjarai/omnihopper/ModConfig.java | 11 --- .../nl/enjarai/omnihopper/OmniHopper.java | 12 +++- .../AbstractFurnaceBlockEntityMixin.java | 4 +- .../assets/omnihopper/lang/en_us.json | 4 +- src/main/resources/fabric.mod.json | 4 +- 8 files changed, 102 insertions(+), 29 deletions(-) delete mode 100644 src/main/java/nl/enjarai/omnihopper/ModConfig.java diff --git a/CHANGELOG.md b/CHANGELOG.md index c2a972b..071f0de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,2 +1,3 @@ -- Added a config option to disable the automatic removal of furnace extraction exceptions. - - This can be turned off to preserve vanilla hopper behaviour when pulling empty buckets from furnaces. \ No newline at end of file +- Replaced the furnace extraction removal exceptions config option with a gamerule for easier configuring. +- Updated Cooldown Coordinator to fix a sizable bug. +- Removed CICADA as an included dependency, it must now be downloaded separately. diff --git a/build.gradle b/build.gradle index da17faa..42ad244 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ plugins { id 'fabric-loom' version '1.6-SNAPSHOT' id 'maven-publish' + id "me.modmuss50.mod-publish-plugin" version "0.4.4" } sourceCompatibility = JavaVersion.VERSION_21 @@ -39,7 +40,7 @@ dependencies { // Include Cooldown Coordinator include(modImplementation("net.gnomecraft:cooldown-coordinator:${project.cooldowncoordinator_version}")) - include modImplementation("nl.enjarai:cicada-lib:${project.cicada_version}") { + modImplementation("nl.enjarai:cicada-lib:${project.cicada_version}") { exclude group: "net.fabricmc.fabric-api" } } @@ -114,4 +115,72 @@ sourceSets { ] } } +} + +publishMods { + file = remapJar.archiveFile + displayName = "${property('mod_version')} for ${property('minecraft_version')}" + version = project.version + changelog = getRootProject().file("CHANGELOG.md").text + type = STABLE + modLoaders.add("fabric") + + def min = property('publish_target_min') + def max = property('publish_target_max') + + if (providers.gradleProperty('enjaraiModrinthToken').present) { + modrinth { + projectId = property('mod_modrinth') + accessToken = providers.gradleProperty('enjaraiModrinthToken').get() + + if (min == max) { + minecraftVersions.add(min) + } else { + minecraftVersionRange { + start = min + end = max + } + } + + requires { + slug = "fabric-api" + } + requires { + slug = "cicada" + } + } + } + + if (providers.gradleProperty('enjaraiCurseforgeToken').present) { + curseforge { + projectId = property('mod_curseforge') + accessToken = providers.gradleProperty('enjaraiCurseforgeToken').get() + + if (min == max) { + minecraftVersions.add(min) + } else { + minecraftVersionRange { + start = min + end = max + } + } + + requires { + slug = "fabric-api" + } + requires { + slug = "cicada" + } + } + } + + if (providers.gradleProperty('enjaraiGithubToken').present) { + github { + repository = property('mod_github') + accessToken = providers.gradleProperty('enjaraiGithubToken').get() + + commitish = property('git_branch') + tagName = project.version + } + } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 67f326b..db819a7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,21 +3,27 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.20.5 -yarn_mappings=1.20.5+build.1 -loader_version=0.15.10 +minecraft_version=1.20.6 +yarn_mappings=1.20.6+build.3 +loader_version=0.15.11 # Mod Properties -mod_version = 2.3.0 +mod_version = 2.3.1 maven_group = nl.enjarai archives_base_name = omnihopper modid = omnihopper +publish_target_min=1.20.5 +publish_target_max=1.20.6 +mod_modrinth=i2u9r3li +mod_curseforge=610606 +mod_github=enjarai/OmniHopper +git_branch=1.20.5/dev # Dependencies -fabric_version=0.97.6+1.20.5 +fabric_version=0.99.4+1.20.6 # https://github.com/gniftygnome/cooldown-coordinator/releases # https://maven.enjarai.dev/#/mirrors/net/gnomecraft/cooldown-coordinator -cooldowncoordinator_version=0.7.1 +cooldowncoordinator_version=0.7.2 # https://maven.enjarai.dev/#/releases/nl/enjarai/cicada-lib -cicada_version=0.6.0+1.20.2-plus +cicada_version=0.7.2+1.20.5-and-above diff --git a/src/main/java/nl/enjarai/omnihopper/ModConfig.java b/src/main/java/nl/enjarai/omnihopper/ModConfig.java deleted file mode 100644 index b4ee73c..0000000 --- a/src/main/java/nl/enjarai/omnihopper/ModConfig.java +++ /dev/null @@ -1,11 +0,0 @@ -package nl.enjarai.omnihopper; - -import net.fabricmc.loader.api.FabricLoader; -import nl.enjarai.cicada.api.util.AbstractModConfig; - -public class ModConfig extends AbstractModConfig { - public static ModConfig INSTANCE = loadConfigFile( - FabricLoader.getInstance().getConfigDir().resolve("omnihopper-server.json"), new ModConfig()); - - public boolean removeFurnaceExtractionExceptions = true; -} diff --git a/src/main/java/nl/enjarai/omnihopper/OmniHopper.java b/src/main/java/nl/enjarai/omnihopper/OmniHopper.java index 084e2c5..36f2c25 100644 --- a/src/main/java/nl/enjarai/omnihopper/OmniHopper.java +++ b/src/main/java/nl/enjarai/omnihopper/OmniHopper.java @@ -1,7 +1,10 @@ package nl.enjarai.omnihopper; import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.gamerule.v1.GameRuleFactory; +import net.fabricmc.fabric.api.gamerule.v1.GameRuleRegistry; import net.minecraft.util.Identifier; +import net.minecraft.world.GameRules; import nl.enjarai.cicada.api.conversation.ConversationManager; import nl.enjarai.cicada.api.util.CicadaEntrypoint; import nl.enjarai.cicada.api.util.JsonSource; @@ -15,17 +18,20 @@ public class OmniHopper implements ModInitializer, CicadaEntrypoint { public static final String MODID = "omnihopper"; public static final Logger LOGGER = ProperLogger.getLogger(MODID); + public static final GameRules.Key REMOVE_FURNACE_EXCEPTIONS = GameRuleRegistry.register( + MODID + ":removeFurnaceExtractionExceptions", + GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true) + ); + @Override public void onInitialize() { ModBlocks.register(); ModItems.register(); ModScreenHandlers.register(); - - var touch = ModConfig.INSTANCE; } public static Identifier id(String path) { - return new Identifier(MODID, path); + return Identifier.of(MODID, path); } @Override diff --git a/src/main/java/nl/enjarai/omnihopper/mixin/AbstractFurnaceBlockEntityMixin.java b/src/main/java/nl/enjarai/omnihopper/mixin/AbstractFurnaceBlockEntityMixin.java index 7504c1a..11f80b8 100644 --- a/src/main/java/nl/enjarai/omnihopper/mixin/AbstractFurnaceBlockEntityMixin.java +++ b/src/main/java/nl/enjarai/omnihopper/mixin/AbstractFurnaceBlockEntityMixin.java @@ -11,7 +11,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; -import nl.enjarai.omnihopper.ModConfig; +import nl.enjarai.omnihopper.OmniHopper; import nl.enjarai.omnihopper.util.FurnaceFuelBucketStorage; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; @@ -56,7 +56,7 @@ protected void setFuelStack(ItemStack fuelItem) { ) ) private boolean removeExtractionExceptions(boolean original) { - if (ModConfig.INSTANCE.removeFurnaceExtractionExceptions) { + if (getWorld().getGameRules().getBoolean(OmniHopper.REMOVE_FURNACE_EXCEPTIONS)) { return false; } return original; diff --git a/src/main/resources/assets/omnihopper/lang/en_us.json b/src/main/resources/assets/omnihopper/lang/en_us.json index 50e3215..b648301 100644 --- a/src/main/resources/assets/omnihopper/lang/en_us.json +++ b/src/main/resources/assets/omnihopper/lang/en_us.json @@ -33,5 +33,7 @@ "container.fluid_omnihopper": "Omni-Flopper", "container.fluid_hopper": "Flopper", "container.wooden_omnihopper": "Omni-Whopper", - "container.wooden_hopper": "Whopper" + "container.wooden_hopper": "Whopper", + + "gamerule.omnihopper:removeFurnaceExtractionExceptions": "[OmniHopper] Remove Furnace fuel slot extraction exceptions" } \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index bbe7625..a3f8a28 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -37,10 +37,10 @@ "accessWidener" : "omnihopper.accesswidener", "depends": { "cooldown-coordinator": "^0.4.3", - "cicada": "*", + "cicada": ">=0.6.0 <1.0.0", "fabric": "*", "fabricloader": ">=0.15", - "minecraft": ">=1.20.5", + "minecraft": ">=1.20.5 <=1.20.6", "java": ">=21" }, "custom": {