From 4dd329ff7276fb033e4e89ea3668abdbc4536ab6 Mon Sep 17 00:00:00 2001 From: Ibrahim Ansari Date: Mon, 30 Oct 2023 02:55:58 +0530 Subject: [PATCH] Update to Minecraft 1.20.2 - Fix F3 debug HUD detection. - Handle new split textures correctly. - Update Gradle, Loom, FLoader/FAPI, Yarn. --- build.gradle | 22 ++++++++++++------- gradle.properties | 10 ++++----- gradle/wrapper/gradle-wrapper.properties | 2 +- .../torohealth/display/BarDisplay.java | 8 +++---- .../net/torocraft/torohealth/display/Hud.java | 2 +- 5 files changed, 25 insertions(+), 19 deletions(-) diff --git a/build.gradle b/build.gradle index da188b8..7427f6f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,15 +1,15 @@ plugins { - id 'fabric-loom' version '1.2-SNAPSHOT' + id 'fabric-loom' version '1.4-SNAPSHOT' id 'maven-publish' } -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 - -archivesBaseName = project.archives_base_name version = project.mod_version group = project.maven_group +base { + archivesName = project.archives_base_name +} + repositories { // Add repositories to retrieve artifacts from in here. // You should only use this when depending on other mods because @@ -19,7 +19,7 @@ repositories { } dependencies { - //to change the versions see the gradle.properties file + // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" @@ -27,6 +27,10 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + // Uncomment the following line to enable the deprecated Fabric API modules. + // These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time. + + // modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}" } processResources { @@ -38,7 +42,6 @@ processResources { } tasks.withType(JavaCompile).configureEach { - // Minecraft 1.18 (1.18-pre2) upwards uses Java 17. it.options.release = 17 } @@ -47,11 +50,14 @@ java { // if it is present. // If you remove this line, sources will not be generated. withSourcesJar() + + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } jar { from("LICENSE") { - rename { "${it}_${project.archivesBaseName}"} + rename { "${it}_${project.base.archivesName.get()}"} } } diff --git a/gradle.properties b/gradle.properties index 2da88e4..d5cede5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,14 +8,14 @@ org.gradle.jvmargs=-Xmx1G # To remap the mixin locations: # gradlew migrateMappings --mappings "1.16.1+build.9" -minecraft_version=1.20.1 -yarn_mappings=1.20.1+build.8 -loader_version=0.14.21 +minecraft_version=1.20.2 +yarn_mappings=1.20.2+build.4 +loader_version=0.14.24 #Fabric api -fabric_version=0.84.0+1.20.1 +fabric_version=0.90.4+1.20.2 # Mod Properties -mod_version = 1.20.1-fabric-2 +mod_version = 1.20.2-fabric-1 maven_group = net.torocraft archives_base_name = torohealth diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1e836ab..15bc934 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.1-bin.zip +distributionUrl=https://services.gradle.org/distributions/gradle-8.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/net/torocraft/torohealth/display/BarDisplay.java b/src/main/java/net/torocraft/torohealth/display/BarDisplay.java index 2d17fe3..278b474 100644 --- a/src/main/java/net/torocraft/torohealth/display/BarDisplay.java +++ b/src/main/java/net/torocraft/torohealth/display/BarDisplay.java @@ -11,7 +11,8 @@ public class BarDisplay { - private static final Identifier ICON_TEXTURES = new Identifier("textures/gui/icons.png"); + private static final Identifier ARMOR_TEXTURE = new Identifier("hud/armor_full"); + private static final Identifier HEART_TEXTURE = new Identifier("hud/heart/full"); private final MinecraftClient mc; public BarDisplay(MinecraftClient mc) { @@ -27,7 +28,6 @@ public void draw(DrawContext drawContext, LivingEntity entity) { RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShader(GameRenderer::getPositionTexProgram); - RenderSystem.setShaderTexture(0, ICON_TEXTURES); RenderSystem.enableBlend(); HealthBarRenderer.render(drawContext.getMatrices(), drawContext.getVertexConsumers(), entity, 63, 14, 130, false); @@ -58,10 +58,10 @@ public void draw(DrawContext drawContext, LivingEntity entity) { } private void renderArmorIcon(DrawContext drawContext, int x, int y) { - drawContext.drawTexture(ICON_TEXTURES, x, y, 34, 9, 9, 9); + drawContext.drawGuiTexture(ARMOR_TEXTURE, x, y, 9, 9); } private void renderHeartIcon(DrawContext drawContext, int x, int y) { - drawContext.drawTexture(ICON_TEXTURES, x, y, 16 + 36, 0, 9, 9); + drawContext.drawGuiTexture(HEART_TEXTURE, x, y, 9, 9); } } diff --git a/src/main/java/net/torocraft/torohealth/display/Hud.java b/src/main/java/net/torocraft/torohealth/display/Hud.java index dee3222..17e15ab 100644 --- a/src/main/java/net/torocraft/torohealth/display/Hud.java +++ b/src/main/java/net/torocraft/torohealth/display/Hud.java @@ -28,7 +28,7 @@ public Hud() { } public void draw(DrawContext drawContext, Config config) { - if (this.client.options.debugEnabled) { + if (this.client.getDebugHud().shouldShowDebugHud()) { return; } this.config = config;