From 74530ea9b08611789d89d7961f750c91820ea187 Mon Sep 17 00:00:00 2001 From: xander Date: Sun, 10 Jul 2022 20:27:01 +0100 Subject: [PATCH] quilt loader fix (closes #30) --- build.gradle.kts | 13 +++---------- changelogs/1.0.4.md | 1 + .../dev/isxander/culllessleaves/CullLessLeaves.java | 10 ++++------ .../culllessleaves/compat/SodiumCompat.java | 2 +- src/main/resources/fabric.mod.json | 3 ++- 5 files changed, 11 insertions(+), 18 deletions(-) create mode 100644 changelogs/1.0.4.md diff --git a/build.gradle.kts b/build.gradle.kts index 2868ed7..babda23 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,7 +13,7 @@ plugins { } group = "dev.isxander" -version = "1.0.3" +version = "1.0.4" repositories { mavenCentral() @@ -21,11 +21,6 @@ repositories { maven("https://maven.shedaniel.me") maven("https://maven.terraformersmc.com") maven("https://maven.flashyreese.me/snapshots") - maven("https://api.modrinth.com/maven") { - content { - includeGroup("maven.modrinth") - } - } } val minecraftVersion: String by project @@ -169,8 +164,8 @@ githubRelease { publishing { publications { create("mod") { - groupId = "dev.isxander" - artifactId = "cull-less-leaves" + groupId = group.toString() + artifactId = base.archivesName.get() from(components["java"]) } @@ -184,8 +179,6 @@ publishing { password = property("xander-repo.password")?.toString() } } - } else { - println("Xander Repo not available!") } } } diff --git a/changelogs/1.0.4.md b/changelogs/1.0.4.md new file mode 100644 index 0000000..8a23d3f --- /dev/null +++ b/changelogs/1.0.4.md @@ -0,0 +1 @@ +- Fix crash on Quilt Loader diff --git a/src/main/java/dev/isxander/culllessleaves/CullLessLeaves.java b/src/main/java/dev/isxander/culllessleaves/CullLessLeaves.java index 81ef405..38003d3 100644 --- a/src/main/java/dev/isxander/culllessleaves/CullLessLeaves.java +++ b/src/main/java/dev/isxander/culllessleaves/CullLessLeaves.java @@ -7,10 +7,10 @@ import me.shedaniel.autoconfig.serializer.Toml4jConfigSerializer; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.loader.api.FabricLoader; +import net.fabricmc.loader.api.Version; import net.fabricmc.loader.api.VersionParsingException; import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint; -import net.fabricmc.loader.impl.FormattedException; -import net.fabricmc.loader.impl.util.version.VersionPredicateParser; +import net.fabricmc.loader.api.metadata.version.VersionComparisonOperator; import net.minecraft.block.LeavesBlock; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -21,14 +21,12 @@ public class CullLessLeaves implements ClientModInitializer, PreLaunchEntrypoint public void onInitializeClient() { FabricLoader.getInstance().getModContainer("moreculling").ifPresent((mod) -> { try { - var predicate = VersionPredicateParser.parse(">=0.5.0"); - if (!predicate.test(mod.getMetadata().getVersion())) { - throw new FormattedException("Incompatible mod set!", "moreculling is present but does not match " + predicate); + if (!VersionComparisonOperator.GREATER_EQUAL.test(mod.getMetadata().getVersion(), Version.parse("0.5.0"))) { + throw new RuntimeException("MoreCulling compatibility requires version >=0.5.0"); } } catch (VersionParsingException e) { e.printStackTrace(); } - }); AutoConfig.register(CullLessLeavesConfig.class, Toml4jConfigSerializer::new); diff --git a/src/main/java/dev/isxander/culllessleaves/compat/SodiumCompat.java b/src/main/java/dev/isxander/culllessleaves/compat/SodiumCompat.java index bc75104..a555f12 100644 --- a/src/main/java/dev/isxander/culllessleaves/compat/SodiumCompat.java +++ b/src/main/java/dev/isxander/culllessleaves/compat/SodiumCompat.java @@ -8,7 +8,7 @@ import net.minecraft.client.MinecraftClient; public class SodiumCompat { - private static final OptionStorage OPTION_STORAGE = new OptionStorage() { + private static final OptionStorage OPTION_STORAGE = new OptionStorage<>() { @Override public CullLessLeavesConfig getData() { return CullLessLeaves.getConfig(); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 9ff6d54..1245e1b 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -32,7 +32,8 @@ "depends": { "fabricloader": ">=0.14.0", "minecraft": "1.19.x", - "java": ">=17" + "java": ">=17", + "cloth-config": "7.x.x" }, "suggests": { "sodium": "*"