diff --git a/gradle.properties b/gradle.properties index a4472c1..9060845 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.6.0 +mod_version=2.6.1 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 f939566..c1e9b52 100644 --- a/src/main/java/org/samo_lego/fabrictailor/config/TailorConfig.java +++ b/src/main/java/org/samo_lego/fabrictailor/config/TailorConfig.java @@ -109,28 +109,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) { - error(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();