From b056bcdf9d8171ffc927b027971ac7429939ba87 Mon Sep 17 00:00:00 2001 From: Alexander Wilson <82721356+LynixPlayz@users.noreply.github.com> Date: Thu, 13 Jun 2024 19:39:55 -0500 Subject: [PATCH 1/2] 1.21 --- build.gradle | 2 +- gradle.properties | 10 +++++----- gradle/wrapper/gradle-wrapper.properties | 2 +- .../io/github/foundationgames/animatica/Animatica.java | 2 +- .../animatica/animation/AnimationLoader.java | 2 +- .../animatica/animation/AnimationMeta.java | 4 ++-- .../animatica/mixin/IdentifierMixin.java | 8 ++++---- .../foundationgames/animatica/util/Utilities.java | 4 ++-- src/main/resources/fabric.mod.json | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/build.gradle b/build.gradle index 556fb08..1f85c52 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.2-SNAPSHOT' + id 'fabric-loom' version '1.6-SNAPSHOT' } sourceCompatibility = JavaVersion.VERSION_17 diff --git a/gradle.properties b/gradle.properties index 1cc90a2..714dd5d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,13 +1,13 @@ org.gradle.jvmargs=-Xmx1G -minecraft_version=1.20.1 -yarn_mappings=1.20.1+build.3 -loader_version=0.14.21 +minecraft_version=1.21 +yarn_mappings=1.21+build.1 +loader_version=0.15.11 #Fabric api -fabric_version=0.83.1+1.20.1 +fabric_version=0.100.1+1.21 -mod_version = 0.6+1.20 +mod_version = 0.6.1+1.21 maven_group = io.github.foundationgames archives_base_name = animatica diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 59bc51a..17655d0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/io/github/foundationgames/animatica/Animatica.java b/src/main/java/io/github/foundationgames/animatica/Animatica.java index cc470a1..7e53344 100644 --- a/src/main/java/io/github/foundationgames/animatica/Animatica.java +++ b/src/main/java/io/github/foundationgames/animatica/Animatica.java @@ -24,6 +24,6 @@ public void onInitializeClient() { } public static Identifier id(String path) { - return new Identifier(NAMESPACE, path); + return Identifier.of(NAMESPACE, path); } } diff --git a/src/main/java/io/github/foundationgames/animatica/animation/AnimationLoader.java b/src/main/java/io/github/foundationgames/animatica/animation/AnimationLoader.java index 33f9a4e..f8e4398 100644 --- a/src/main/java/io/github/foundationgames/animatica/animation/AnimationLoader.java +++ b/src/main/java/io/github/foundationgames/animatica/animation/AnimationLoader.java @@ -95,7 +95,7 @@ public void reload(ResourceManager manager) { for (var targetId : animations.keySet()) { AnimatedTexture.tryCreate(manager, targetId, animations.get(targetId)) .ifPresent(tex -> { - var animId = new Identifier(targetId.getNamespace(), targetId.getPath() + "-anim"); + var animId = Identifier.of(targetId.getNamespace(), targetId.getPath() + "-anim"); this.animationIds.put(targetId, animId); this.animatedTextures.add(tex); tex.registerTexture(MinecraftClient.getInstance().getTextureManager(), manager, animId, MinecraftClient.getInstance()); diff --git a/src/main/java/io/github/foundationgames/animatica/animation/AnimationMeta.java b/src/main/java/io/github/foundationgames/animatica/animation/AnimationMeta.java index 97aba3d..ac7f341 100644 --- a/src/main/java/io/github/foundationgames/animatica/animation/AnimationMeta.java +++ b/src/main/java/io/github/foundationgames/animatica/animation/AnimationMeta.java @@ -22,10 +22,10 @@ public static AnimationMeta of(Identifier file, Properties properties) throws Pr Identifier source; Identifier target; try { - source = Utilities.processPath(file, new Identifier(PropertyUtil.get(file, properties, "from"))); + source = Utilities.processPath(file, Identifier.of(PropertyUtil.get(file, properties, "from"))); } catch (InvalidIdentifierException ex) { throw new InvalidPropertyException(file, "from", "resource location"); } try { - target = Utilities.processPath(file, new Identifier(PropertyUtil.get(file, properties, "to"))); + target = Utilities.processPath(file, Identifier.of(PropertyUtil.get(file, properties, "to"))); } catch (InvalidIdentifierException ex) { throw new InvalidPropertyException(file, "to", "resource location"); } return new AnimationMeta( source, diff --git a/src/main/java/io/github/foundationgames/animatica/mixin/IdentifierMixin.java b/src/main/java/io/github/foundationgames/animatica/mixin/IdentifierMixin.java index ff86b14..fcf3e17 100644 --- a/src/main/java/io/github/foundationgames/animatica/mixin/IdentifierMixin.java +++ b/src/main/java/io/github/foundationgames/animatica/mixin/IdentifierMixin.java @@ -12,10 +12,10 @@ // Allows invalid characters in paths to support packs with extremely outdated formatting (because OptiFine does too) @Mixin(Identifier.class) public class IdentifierMixin { - @Inject(method = "([Ljava/lang/String;)V", at = @At("TAIL")) - private void animatica$reportInvalidIdentifierCharacters(String[] id, CallbackInfo ci) { - if (Flags.ALLOW_INVALID_ID_CHARS && !animatica$isPathAllowed(id[1]) && !id[1].startsWith("~/")) { - Animatica.LOG.warn("Legacy resource pack is using an invalid namespaced identifier '{}:{}'! DO NOT use non [a-z0-9_.-] characters for resource pack files and file names!", id[0], id[1]); + @Inject(method = "of(Ljava/lang/String;)Lnet/minecraft/util/Identifier;", at = @At("TAIL")) + private static void animatica$reportInvalidIdentifierCharacters(String id, CallbackInfoReturnable ci) { + if (Flags.ALLOW_INVALID_ID_CHARS && !animatica$isPathAllowed(Identifier.splitOn(id, ':').getPath()) && !Identifier.splitOn(id, ':').getPath().startsWith("~/")) { + Animatica.LOG.warn("Legacy resource pack is using an invalid namespaced identifier '{}'! DO NOT use non [a-z0-9_.-] characters for resource pack files and file names!", id); } } diff --git a/src/main/java/io/github/foundationgames/animatica/util/Utilities.java b/src/main/java/io/github/foundationgames/animatica/util/Utilities.java index c3e408d..a60d22a 100644 --- a/src/main/java/io/github/foundationgames/animatica/util/Utilities.java +++ b/src/main/java/io/github/foundationgames/animatica/util/Utilities.java @@ -9,10 +9,10 @@ public static Identifier processPath(Identifier fileRelativeTo, Identifier path) if (lInd > 0) { var builder = new StringBuilder(fileRelativeTo.getPath()); builder.replace(lInd, builder.length(), path.getPath().replaceFirst("\\./", "/")); - return new Identifier(fileRelativeTo.getNamespace(), builder.toString()); + return Identifier.of(fileRelativeTo.getNamespace(), builder.toString()); } } else if (path.getPath().startsWith("~/")) { - return new Identifier(path.getNamespace(), path.getPath().replaceFirst("~/", "optifine/")); + return Identifier.of(path.getNamespace(), path.getPath().replaceFirst("~/", "optifine/")); } return path; } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 97de7bc..a04dd2a 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -28,7 +28,7 @@ "depends": { "fabricloader": ">=0.11.3", "fabric": "*", - "minecraft": ["1.19.4", "1.20.x"], + "minecraft": ["1.21.x"], "java": ">=16" } } From 4a772e8c99a233d208a2369400b80b4b05d4b8d4 Mon Sep 17 00:00:00 2001 From: Alexander Wilson <82721356+LynixPlayz@users.noreply.github.com> Date: Thu, 13 Jun 2024 20:42:57 -0500 Subject: [PATCH 2/2] Fix crash --- .../animatica/mixin/VideoOptionsScreenMixin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/foundationgames/animatica/mixin/VideoOptionsScreenMixin.java b/src/main/java/io/github/foundationgames/animatica/mixin/VideoOptionsScreenMixin.java index 3bc7322..f8f38f1 100644 --- a/src/main/java/io/github/foundationgames/animatica/mixin/VideoOptionsScreenMixin.java +++ b/src/main/java/io/github/foundationgames/animatica/mixin/VideoOptionsScreenMixin.java @@ -16,7 +16,7 @@ protected VideoOptionsScreenMixin(Text title) { } @ModifyArg( - method = "init", + method = "addOptions", at = @At( value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/OptionListWidget;addAll([Lnet/minecraft/client/option/SimpleOption;)V"