diff --git a/veinminer-fabric/gradle.properties b/veinminer-fabric/gradle.properties index 371cbc2f..7369d16c 100644 --- a/veinminer-fabric/gradle.properties +++ b/veinminer-fabric/gradle.properties @@ -1,6 +1,5 @@ -# Fabric Properties. (Check these on https://fabricmc.net/develop) -minecraft_version=1.19.3 -loader_version=0.14.12 +minecraft_version=1.20.1 +loader_version=0.14.21 #Fabric api -fabric_version=0.71.0+1.19.3 +fabric_version=0.84.0+1.20.1 diff --git a/veinminer-fabric/src/main/java/wtf/choco/veinminer/VeinMinerMod.java b/veinminer-fabric/src/main/java/wtf/choco/veinminer/VeinMinerMod.java index d99ac7bc..14a3a0d3 100644 --- a/veinminer-fabric/src/main/java/wtf/choco/veinminer/VeinMinerMod.java +++ b/veinminer-fabric/src/main/java/wtf/choco/veinminer/VeinMinerMod.java @@ -104,7 +104,7 @@ public void onInitializeClient() { } // Updating the new last looked at position - if (client.player != null && client.player.level != null && !client.player.level.isEmptyBlock(position)) { + if (client.player != null && client.player.level() != null && !client.player.level().isEmptyBlock(position)) { getServerState().setLastLookedAt(position, blockFace); } else { getServerState().setLastLookedAt(null, null); @@ -154,7 +154,7 @@ else if (KEY_MAPPING_PREVIOUS_PATTERN.isDown()) { serverState.sendMessage(new PluginMessageServerboundHandshake(VeinMiner.PROTOCOL.getVersion())); }); - HudRenderCallback.EVENT.register((stack, tickDelta) -> { + HudRenderCallback.EVENT.register((graphics, tickDelta) -> { if (!hasServerState() || !getServerState().isEnabledOnServer()) { return; } @@ -167,7 +167,7 @@ else if (KEY_MAPPING_PREVIOUS_PATTERN.isDown()) { continue; } - component.render(client, stack, tickDelta); + component.render(client, graphics, tickDelta); } }); diff --git a/veinminer-fabric/src/main/java/wtf/choco/veinminer/hud/HudRenderComponent.java b/veinminer-fabric/src/main/java/wtf/choco/veinminer/hud/HudRenderComponent.java index b501005b..b3705ec3 100644 --- a/veinminer-fabric/src/main/java/wtf/choco/veinminer/hud/HudRenderComponent.java +++ b/veinminer-fabric/src/main/java/wtf/choco/veinminer/hud/HudRenderComponent.java @@ -3,6 +3,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import org.jetbrains.annotations.NotNull; @@ -17,10 +18,10 @@ public interface HudRenderComponent { * Render the component to the given {@link PoseStack}. * * @param client the client instance - * @param stack the stack to which the hud is being rendered + * @param graphics the gui graphics * @param tickDelta tick delta time */ - public void render(@NotNull Minecraft client, @NotNull PoseStack stack, float tickDelta); + public void render(@NotNull Minecraft client, @NotNull GuiGraphics graphics, float tickDelta); /** * Check whether or not this component should be rendered to the screen. diff --git a/veinminer-fabric/src/main/java/wtf/choco/veinminer/hud/HudRenderComponentPatternWheel.java b/veinminer-fabric/src/main/java/wtf/choco/veinminer/hud/HudRenderComponentPatternWheel.java index 2854e436..2c86ef00 100644 --- a/veinminer-fabric/src/main/java/wtf/choco/veinminer/hud/HudRenderComponentPatternWheel.java +++ b/veinminer-fabric/src/main/java/wtf/choco/veinminer/hud/HudRenderComponentPatternWheel.java @@ -4,6 +4,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.util.Mth; @@ -25,9 +26,10 @@ public final class HudRenderComponentPatternWheel implements HudRenderComponent private float remainingMs = -1L; @Override - public void render(@NotNull Minecraft client, @NotNull PoseStack stack, float tickDelta) { + public void render(@NotNull Minecraft client, @NotNull GuiGraphics graphics, float tickDelta) { client.getProfiler().push("veinminerPatternWheel"); + PoseStack stack = graphics.pose(); stack.pushPose(); stack.translate(4, 0, 0); @@ -54,13 +56,13 @@ else if (remainingMs < FADE_MS) { // Fade out String selected = serverState.getSelectedPattern().toString(); String after = serverState.getNextPattern().toString(); - client.font.drawShadow(stack, Component.literal(selected), 0, client.font.lineHeight, colour); + graphics.drawString(client.font, Component.literal(selected), 0, client.font.lineHeight, colour); stack.pushPose(); stack.translate(0, 3, 0); stack.scale(0.6F, 0.6F, 0.6F); - client.font.drawShadow(stack, Component.literal(before), 0, 0, colour); - client.font.drawShadow(stack, Component.literal(after), 0, client.font.lineHeight * 3, colour); + graphics.drawString(client.font, Component.literal(before), 0, 0, colour); + graphics.drawString(client.font, Component.literal(after), 0, client.font.lineHeight * 3, colour); stack.popPose(); RenderSystem.disableBlend(); diff --git a/veinminer-fabric/src/main/java/wtf/choco/veinminer/hud/HudRenderComponentVeinMiningIcon.java b/veinminer-fabric/src/main/java/wtf/choco/veinminer/hud/HudRenderComponentVeinMiningIcon.java index 087b1384..d0ea9df4 100644 --- a/veinminer-fabric/src/main/java/wtf/choco/veinminer/hud/HudRenderComponentVeinMiningIcon.java +++ b/veinminer-fabric/src/main/java/wtf/choco/veinminer/hud/HudRenderComponentVeinMiningIcon.java @@ -1,12 +1,9 @@ package wtf.choco.veinminer.hud; import com.mojang.blaze3d.platform.Window; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiComponent; -import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.NotNull; @@ -19,23 +16,16 @@ */ public final class HudRenderComponentVeinMiningIcon implements HudRenderComponent { - private static final ResourceLocation TEXTURE_VEINMINER_ICON = new ResourceLocation("veinminer_companion", "textures/gui/veinminer_icon.png"); + private static final ResourceLocation VEINMINER_ICON_LOCATION = new ResourceLocation("veinminer_companion", "textures/gui/veinminer_icon.png"); @Override - public void render(@NotNull Minecraft client, @NotNull PoseStack stack, float delta) { + public void render(@NotNull Minecraft client, @NotNull GuiGraphics graphics, float delta) { client.getProfiler().push("veinMiningIcon"); Window window = client.getWindow(); int width = window.getGuiScaledWidth(), height = window.getGuiScaledHeight(); - stack.pushPose(); - - RenderSystem.setShader(GameRenderer::getPositionTexShader); - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.setShaderTexture(0, TEXTURE_VEINMINER_ICON); - GuiComponent.blit(stack, (width / 2) + 8, (height / 2) - 4, 0, 0, 8, 8, 8, 8); - - stack.popPose(); + graphics.blit(VEINMINER_ICON_LOCATION, (width / 2) + 8, (height / 2) - 4, 0, 0, 8, 8, 8, 8); client.getProfiler().pop(); } diff --git a/veinminer-fabric/src/main/resources/fabric.mod.json b/veinminer-fabric/src/main/resources/fabric.mod.json index 4c0fb739..17900739 100644 --- a/veinminer-fabric/src/main/resources/fabric.mod.json +++ b/veinminer-fabric/src/main/resources/fabric.mod.json @@ -29,9 +29,9 @@ "accessWidener" : "veinminer_companion.accesswidener", "depends": { - "fabricloader": ">=0.10", + "fabricloader": ">=0.10", "fabric": "*", - "minecraft": ">=1.19.3", + "minecraft": ">=1.20", "java": ">=17" } }