From 172ba57f6b62fb9ef6ffba4540365aef21473678 Mon Sep 17 00:00:00 2001 From: samolego <34912839+samolego@users.noreply.github.com> Date: Mon, 2 Dec 2024 09:12:06 +0100 Subject: [PATCH] Update to 1.21.4 --- gradle.properties | 10 ++++----- .../fabrictailor/config/TailorConfig.java | 21 +++++-------------- .../mixin/client/MHttpTexture_HDEnabler.java | 10 ++++----- 3 files changed, 15 insertions(+), 26 deletions(-) diff --git a/gradle.properties b/gradle.properties index baa977c..c0ecbf2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,14 +1,14 @@ # Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx1G # Fabric Properties -minecraft_version=1.21.2 -yarn_mappings=1.21.2+build.1 -loader_version=0.16.7 +minecraft_version=1.21.4-rc3 +yarn_mappings=1.21.4-rc3+build.3 +loader_version=0.16.9 # Fabric API -fabric_version=0.106.1+1.21.2 +fabric_version=0.110.3+1.21.4 # Mod Properties -mod_version=2.5.2 +mod_version=2.5.3 maven_group=org.samo_lego archives_base_name=fabrictailor # Dependencies diff --git a/src/main/java/org/samo_lego/fabrictailor/config/TailorConfig.java b/src/main/java/org/samo_lego/fabrictailor/config/TailorConfig.java index 786bfa2..154081f 100644 --- a/src/main/java/org/samo_lego/fabrictailor/config/TailorConfig.java +++ b/src/main/java/org/samo_lego/fabrictailor/config/TailorConfig.java @@ -92,28 +92,17 @@ public static class DefaultSkin { * @return TaterzenLanguage object */ public static TailorConfig loadConfigFile(File file, boolean serverEnvironment) { - TailorConfig config = null; - if (file.exists()) { - try (BufferedReader fileReader = new BufferedReader( - new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8) - )) { - config = gson.fromJson(fileReader, TailorConfig.class); - } catch (IOException e) { - errorLog(MOD_ID + " Problem occurred when trying to load config: " + e.getMessage()); - } - } - if(config == null) { + return IBrigadierConfigurator.loadConfigFile(file, TailorConfig.class, () -> { // Config doesn't exist yet - config = new TailorConfig(); - if(serverEnvironment) { + var config = new TailorConfig(); + if (serverEnvironment) { // A bit different default config config.skinChangeTimer = 60; } else { config.defaultSkin.applyToAll = true; } - } - config.save(); - return config; + return config; + }); } } diff --git a/src/main/java/org/samo_lego/fabrictailor/mixin/client/MHttpTexture_HDEnabler.java b/src/main/java/org/samo_lego/fabrictailor/mixin/client/MHttpTexture_HDEnabler.java index c0842ab..a2dc891 100644 --- a/src/main/java/org/samo_lego/fabrictailor/mixin/client/MHttpTexture_HDEnabler.java +++ b/src/main/java/org/samo_lego/fabrictailor/mixin/client/MHttpTexture_HDEnabler.java @@ -1,7 +1,7 @@ package org.samo_lego.fabrictailor.mixin.client; import com.mojang.blaze3d.platform.NativeImage; -import net.minecraft.client.renderer.texture.HttpTexture; +import net.minecraft.client.renderer.texture.SkinTextureDownloader; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; @@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -@Mixin(HttpTexture.class) +@Mixin(SkinTextureDownloader.class) public abstract class MHttpTexture_HDEnabler { @Shadow @@ -30,13 +30,13 @@ private static void doNotchTransparencyHack(NativeImage image, int x1, int y1, i * @reason Enable HD textures */ @Inject(method = "processLegacySkin", at = @At("HEAD"), cancellable = true) - private void ft_enableHD(NativeImage skinImg, CallbackInfoReturnable cir) { - cir.setReturnValue(this.ft_proccessSkin(skinImg)); + private static void ft_enableHD(NativeImage skinImg, String string, CallbackInfoReturnable cir) { + cir.setReturnValue(ft_proccessSkin(skinImg)); } @Unique - private NativeImage ft_proccessSkin(NativeImage skinImg) { + private static NativeImage ft_proccessSkin(NativeImage skinImg) { int height = skinImg.getHeight(); int width = skinImg.getWidth();