From 79b353504c6d23c6a7427da1da7d73b2db0535e0 Mon Sep 17 00:00:00 2001 From: Kenny-Hui Date: Thu, 6 Mar 2025 13:14:52 +0800 Subject: [PATCH] Update to 1.21.4 --- build.gradle | 2 +- gradle.properties | 10 +++++----- gradle/wrapper/gradle-wrapper.properties | 2 +- .../customsplashscreen/texture/ConfigTexture.java | 15 +++++++++------ .../customsplashscreen/texture/EmptyTexture.java | 10 ++++++---- src/main/resources/customsplashscreen.mixins.json | 2 +- 6 files changed, 23 insertions(+), 18 deletions(-) diff --git a/build.gradle b/build.gradle index a70b071..270a105 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.7-SNAPSHOT' + id 'fabric-loom' version '1.10-SNAPSHOT' id 'maven-publish' id "me.shedaniel.unified-publishing" version "0.1.+" } diff --git a/gradle.properties b/gradle.properties index ddd2970..b8a7490 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/use - minecraft_version=1.21.3 - yarn_mappings=1.21.3+build.2 - loader_version=0.16.9 + minecraft_version=1.21.4 + yarn_mappings=1.21.4+build.8 + loader_version=0.16.10 # Mod Properties mod_version = 2.3.0 @@ -17,5 +17,5 @@ org.gradle.jvmargs=-Xmx1G # Dependencies # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api - fabric_version=0.107.0+1.21.3 - midnightlib_version=1.6.4-fabric \ No newline at end of file + fabric_version=0.118.0+1.21.4 + midnightlib_version=1.6.9+1.21.4-fabric \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a441313..cea7a79 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/eu/midnightdust/customsplashscreen/texture/ConfigTexture.java b/src/main/java/eu/midnightdust/customsplashscreen/texture/ConfigTexture.java index 11d9d1a..90ce00b 100644 --- a/src/main/java/eu/midnightdust/customsplashscreen/texture/ConfigTexture.java +++ b/src/main/java/eu/midnightdust/customsplashscreen/texture/ConfigTexture.java @@ -4,6 +4,7 @@ import net.minecraft.client.resource.metadata.TextureResourceMetadata; import net.minecraft.client.texture.NativeImage; import net.minecraft.client.texture.ResourceTexture; +import net.minecraft.client.texture.TextureContents; import net.minecraft.resource.ResourceManager; import net.minecraft.util.Identifier; import net.minecraft.util.math.random.Random; @@ -25,10 +26,12 @@ public ConfigTexture(Identifier location) { super(location); } - protected TextureData loadTextureData(ResourceManager resourceManager) { + @Override + public TextureContents loadContents(ResourceManager resourceManager) { try { - InputStream input = new FileInputStream(CustomSplashScreenClient.CONFIG_PATH+"/"+this.location.getPath()); - if (this.location.getPath().equals("background.png") && CustomSplashScreenClient.CONFIG_PATH.toPath().resolve("backgrounds").toFile().isDirectory()) { + Identifier location = getId(); + InputStream input = new FileInputStream(CustomSplashScreenClient.CONFIG_PATH+"/"+location.getPath()); + if (location.getPath().equals("background.png") && CustomSplashScreenClient.CONFIG_PATH.toPath().resolve("backgrounds").toFile().isDirectory()) { if (CustomSplashScreenClient.CONFIG_PATH.toPath().resolve("backgrounds").toFile().listFiles() != null) { File[] backgrounds = Arrays.stream(Objects.requireNonNull(CustomSplashScreenClient.CONFIG_PATH.toPath().resolve("backgrounds").toFile().listFiles())).filter(file -> file.toString().endsWith(".png") || file.toString().endsWith(".jpg") || file.toString().endsWith(".jpeg")).toList().toArray(new File[0]); if (backgrounds.length > 0) { @@ -39,17 +42,17 @@ protected TextureData loadTextureData(ResourceManager resourceManager) { } } - TextureData texture; + TextureContents texture; try { - texture = new TextureData(new TextureResourceMetadata(shouldBlur, true), NativeImage.read(input)); + texture = new TextureContents(NativeImage.read(input), new TextureResourceMetadata(shouldBlur, true)); } finally { input.close(); } return texture; } catch (IOException var18) { - return new TextureData(var18); + return TextureContents.createMissing(); } } diff --git a/src/main/java/eu/midnightdust/customsplashscreen/texture/EmptyTexture.java b/src/main/java/eu/midnightdust/customsplashscreen/texture/EmptyTexture.java index ee25ac2..f013f67 100644 --- a/src/main/java/eu/midnightdust/customsplashscreen/texture/EmptyTexture.java +++ b/src/main/java/eu/midnightdust/customsplashscreen/texture/EmptyTexture.java @@ -3,6 +3,7 @@ import net.minecraft.client.resource.metadata.TextureResourceMetadata; import net.minecraft.client.texture.NativeImage; import net.minecraft.client.texture.ResourceTexture; +import net.minecraft.client.texture.TextureContents; import net.minecraft.resource.ResourceManager; import net.minecraft.util.Identifier; @@ -16,15 +17,16 @@ public EmptyTexture(Identifier location) { super(location); } - protected TextureData loadTextureData(ResourceManager resourceManager) { + @Override + public TextureContents loadContents(ResourceManager resourceManager) { try { InputStream input = Thread.currentThread().getContextClassLoader().getResourceAsStream("empty.png"); - TextureData texture = null; + TextureContents texture = null; if( input != null ) { try { - texture = new TextureData(new TextureResourceMetadata(true, true), NativeImage.read(input)); + texture = new TextureContents(NativeImage.read(input), new TextureResourceMetadata(true, true)); } finally { input.close(); } @@ -33,7 +35,7 @@ protected TextureData loadTextureData(ResourceManager resourceManager) { return texture; } catch (IOException var18) { - return new TextureData(var18); + return TextureContents.createMissing(); } } diff --git a/src/main/resources/customsplashscreen.mixins.json b/src/main/resources/customsplashscreen.mixins.json index 3957c43..972c86a 100644 --- a/src/main/resources/customsplashscreen.mixins.json +++ b/src/main/resources/customsplashscreen.mixins.json @@ -1,7 +1,7 @@ { "required": true, "package": "eu.midnightdust.customsplashscreen.mixin", - "compatibilityLevel": "JAVA_17", + "compatibilityLevel": "JAVA_21", "client": [ "MixinSplashScreen", "MixinMidnightConfig"