From 196a58573faa0d4b0e0490fb5224484206b0aec5 Mon Sep 17 00:00:00 2001 From: Ibrahim Ansari Date: Thu, 5 Dec 2024 15:22:14 +0530 Subject: [PATCH] WIP: Update to Minecraft 1.21.2/1.21.3 - Adapt to minor API changes. - Update Gradle, Loom, FLoader/FAPI, Yarn. --- gradle.properties | 8 ++++---- .../net/torocraft/torohealth/bars/HealthBarRenderer.java | 6 +++--- .../net/torocraft/torohealth/bars/ParticleRenderer.java | 4 ++-- .../java/net/torocraft/torohealth/display/BarDisplay.java | 4 ++-- .../java/net/torocraft/torohealth/util/EntityUtil.java | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gradle.properties b/gradle.properties index d79444f..a7589dd 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.21.1 -yarn_mappings=1.21.1+build.3 +minecraft_version=1.21.3 +yarn_mappings=1.21.3+build.2 loader_version=0.16.9 #Fabric api -fabric_version=0.110.0+1.21.1 +fabric_version=0.110.0+1.21.3 # Mod Properties -mod_version = 1.21.1-fabric-1 +mod_version = 1.21.3-fabric-1 maven_group = net.torocraft archives_base_name = torohealth diff --git a/src/main/java/net/torocraft/torohealth/bars/HealthBarRenderer.java b/src/main/java/net/torocraft/torohealth/bars/HealthBarRenderer.java index 0e54c14..d7e636d 100644 --- a/src/main/java/net/torocraft/torohealth/bars/HealthBarRenderer.java +++ b/src/main/java/net/torocraft/torohealth/bars/HealthBarRenderer.java @@ -5,10 +5,10 @@ import java.util.List; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gl.ShaderProgramKeys; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.BufferRenderer; import net.minecraft.client.render.Camera; -import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexFormat; @@ -91,7 +91,7 @@ public static void renderInWorld(MatrixStack matrix, return; } - RenderSystem.setShader(GameRenderer::getPositionColorProgram); + RenderSystem.setShader(ShaderProgramKeys.POSITION_COLOR); RenderSystem.enableDepthTest(); RenderSystem.enableBlend(); RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, @@ -193,7 +193,7 @@ private static void drawBar(Matrix4f matrix4f, double x, double y, float width, float b = (color & 255) / 255.0F; RenderSystem.setShaderColor(r, g, b, 1); - RenderSystem.setShader(GameRenderer::getPositionTexProgram); + RenderSystem.setShader(ShaderProgramKeys.POSITION_TEX); RenderSystem.setShaderTexture(0, GUI_BARS_TEXTURES); RenderSystem.enableBlend(); diff --git a/src/main/java/net/torocraft/torohealth/bars/ParticleRenderer.java b/src/main/java/net/torocraft/torohealth/bars/ParticleRenderer.java index f06eb57..c7b3f12 100644 --- a/src/main/java/net/torocraft/torohealth/bars/ParticleRenderer.java +++ b/src/main/java/net/torocraft/torohealth/bars/ParticleRenderer.java @@ -2,8 +2,8 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gl.ShaderProgramKeys; import net.minecraft.client.render.Camera; -import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.math.MathHelper; @@ -46,7 +46,7 @@ private static void renderParticle(MatrixStack matrix, VertexConsumerProvider ve matrix.multiply(RotationAxis.POSITIVE_X.rotationDegrees(camera.getPitch())); matrix.scale(-scaleToGui, -scaleToGui, scaleToGui); - RenderSystem.setShader(GameRenderer::getPositionColorProgram); + RenderSystem.setShader(ShaderProgramKeys.POSITION_COLOR); RenderSystem.enableDepthTest(); RenderSystem.enableBlend(); RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, diff --git a/src/main/java/net/torocraft/torohealth/display/BarDisplay.java b/src/main/java/net/torocraft/torohealth/display/BarDisplay.java index e1a5098..b83c475 100644 --- a/src/main/java/net/torocraft/torohealth/display/BarDisplay.java +++ b/src/main/java/net/torocraft/torohealth/display/BarDisplay.java @@ -2,8 +2,8 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gl.ShaderProgramKeys; import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.render.GameRenderer; import net.minecraft.entity.LivingEntity; import net.minecraft.util.Identifier; import net.minecraft.util.math.MathHelper; @@ -27,7 +27,7 @@ public void draw(DrawContext drawContext, LivingEntity entity) { int xOffset = 0; RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.setShader(GameRenderer::getPositionTexProgram); + RenderSystem.setShader(ShaderProgramKeys.POSITION_TEX); RenderSystem.enableBlend(); HealthBarRenderer.render(drawContext.getMatrices(), drawContext.getVertexConsumers(), entity, 63, 14, 130, false); diff --git a/src/main/java/net/torocraft/torohealth/util/EntityUtil.java b/src/main/java/net/torocraft/torohealth/util/EntityUtil.java index 1f8629c..19a62bc 100644 --- a/src/main/java/net/torocraft/torohealth/util/EntityUtil.java +++ b/src/main/java/net/torocraft/torohealth/util/EntityUtil.java @@ -49,7 +49,7 @@ public static boolean showHealthBar(Entity entity, MinecraftClient client) { && (!entity.isInvisibleTo(client.player) || entity.isGlowing() || entity.isOnFire() - || entity instanceof CreeperEntity && ((CreeperEntity) entity).shouldRenderOverlay() // charged creeper + || entity instanceof CreeperEntity && ((CreeperEntity) entity).isCharged() // charged creeper || StreamSupport.stream(living.getEquippedItems().spliterator(), false).anyMatch(is -> !is.isEmpty())) && entity != client.player && !entity.isSpectator();