diff --git a/gradle.properties b/gradle.properties index fafa8e4..3d97a9e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,11 +5,11 @@ loom.platform=forge # Base properties # minecraft version - minecraft_version=1.19.4 + minecraft_version=1.20.1 # forge version, latest version can be found on https://files.minecraftforge.net/ - forge_version=1.19.4-45.1.0 + forge_version=1.20.1-47.0.19 # yarn, latest version can be found on https://fabricmc.net/develop/ - yarn_mappings=1.19.4+build.1 + yarn_mappings=1.20.1+build.2 # Mod Properties mod_version=0.1.2 @@ -19,4 +19,4 @@ loom.platform=forge mod_author=ThinkingStudio # Dependencies - malilib_version=0.1.7-mc1.19.4 + malilib_version=0.1.0-mc1.20.1 diff --git a/src/main/java/fi/dy/masa/minihud/MiniHUD.java b/src/main/java/fi/dy/masa/minihud/MiniHUD.java index 76afae6..10669ff 100644 --- a/src/main/java/fi/dy/masa/minihud/MiniHUD.java +++ b/src/main/java/fi/dy/masa/minihud/MiniHUD.java @@ -25,7 +25,6 @@ public MiniHUD() { public void onInitializeClient(FMLClientSetupEvent event) { ForgePlatformCompat.getInstance().getModClientExtensionPoint(); InitializationHandler.getInstance().registerInitializationHandler(new InitHandler()); - ForgePlatformCompat.getInstance().getMod(Reference.MOD_ID).registerModConfigScreen((screen) -> { GuiConfigs gui = new GuiConfigs(); gui.setParent(screen); diff --git a/src/main/java/fi/dy/masa/minihud/event/RenderHandler.java b/src/main/java/fi/dy/masa/minihud/event/RenderHandler.java index 328716e..a3cde63 100644 --- a/src/main/java/fi/dy/masa/minihud/event/RenderHandler.java +++ b/src/main/java/fi/dy/masa/minihud/event/RenderHandler.java @@ -12,12 +12,14 @@ import java.util.concurrent.CompletableFuture; import javax.annotation.Nullable; import org.joml.Matrix4f; + import net.minecraft.block.BeehiveBlock; import net.minecraft.block.BlockState; import net.minecraft.block.entity.AbstractFurnaceBlockEntity; import net.minecraft.block.entity.BeehiveBlockEntity; import net.minecraft.block.entity.BlockEntity; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.network.PlayerListEntry; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; @@ -47,6 +49,7 @@ import net.minecraft.world.chunk.ChunkStatus; import net.minecraft.world.chunk.WorldChunk; import net.minecraft.world.chunk.light.LightingProvider; + import fi.dy.masa.malilib.config.HudAlignment; import fi.dy.masa.malilib.gui.GuiBase; import fi.dy.masa.malilib.interfaces.IRenderer; @@ -73,12 +76,9 @@ public class RenderHandler implements IRenderer private final DataStorage data; private final Date date; private final Map> chunkFutures = new HashMap<>(); - private int fps; - private int fpsCounter; - private long fpsUpdateTime = System.currentTimeMillis(); - private long infoUpdateTime; - private Set addedTypes = new HashSet<>(); + private final Set addedTypes = new HashSet<>(); @Nullable private WorldChunk cachedClientChunk; + private long infoUpdateTime; private final List lineWrappers = new ArrayList<>(); private final List lines = new ArrayList<>(); @@ -111,7 +111,7 @@ public static void fixDebugRendererState() } @Override - public void onRenderGameOverlayPost(MatrixStack matrixStack) + public void onRenderGameOverlayPost(DrawContext context) { if (Configs.Generic.MAIN_RENDERING_TOGGLE.getBooleanValue() == false) { @@ -142,12 +142,12 @@ public void onRenderGameOverlayPost(MatrixStack matrixStack) boolean useBackground = Configs.Generic.USE_TEXT_BACKGROUND.getBooleanValue(); boolean useShadow = Configs.Generic.USE_FONT_SHADOW.getBooleanValue(); - RenderUtils.renderText(x, y, Configs.Generic.FONT_SCALE.getDoubleValue(), textColor, bgColor, alignment, useBackground, useShadow, this.lines, matrixStack); + RenderUtils.renderText(x, y, Configs.Generic.FONT_SCALE.getDoubleValue(), textColor, bgColor, alignment, useBackground, useShadow, this.lines, context); } } @Override - public void onRenderTooltipLast(ItemStack stack, int x, int y) + public void onRenderTooltipLast(DrawContext drawContext, ItemStack stack, int x, int y) { if (stack.getItem() instanceof FilledMapItem) { @@ -162,7 +162,7 @@ else if (Configs.Generic.SHULKER_BOX_PREVIEW.getBooleanValue()) if (render) { - fi.dy.masa.malilib.render.RenderUtils.renderShulkerBoxPreview(stack, x, y, Configs.Generic.SHULKER_DISPLAY_BACKGROUND_COLOR.getBooleanValue()); + fi.dy.masa.malilib.render.RenderUtils.renderShulkerBoxPreview(stack, x, y, Configs.Generic.SHULKER_DISPLAY_BACKGROUND_COLOR.getBooleanValue(), drawContext); } } } diff --git a/src/main/java/fi/dy/masa/minihud/gui/widgets/WidgetShapeEntry.java b/src/main/java/fi/dy/masa/minihud/gui/widgets/WidgetShapeEntry.java index 2cf9bc8..5ee22b9 100644 --- a/src/main/java/fi/dy/masa/minihud/gui/widgets/WidgetShapeEntry.java +++ b/src/main/java/fi/dy/masa/minihud/gui/widgets/WidgetShapeEntry.java @@ -2,7 +2,9 @@ import java.util.List; import com.mojang.blaze3d.systems.RenderSystem; -import net.minecraft.client.util.math.MatrixStack; + +import net.minecraft.client.gui.DrawContext; + import fi.dy.masa.malilib.gui.GuiBase; import fi.dy.masa.malilib.gui.button.ButtonBase; import fi.dy.masa.malilib.gui.button.ButtonGeneric; @@ -67,7 +69,7 @@ public boolean canSelectAt(int mouseX, int mouseY, int mouseButton) } @Override - public void render(int mouseX, int mouseY, boolean selected, MatrixStack matrixStack) + public void render(int mouseX, int mouseY, boolean selected, DrawContext context) { RenderUtils.color(1f, 1f, 1f, 1f); @@ -94,24 +96,22 @@ else if (this.isOdd) } String name = this.shape.getDisplayName(); - this.drawString(this.x + 4, this.y + 7, 0xFFFFFFFF, name, matrixStack); + this.drawString(this.x + 4, this.y + 7, 0xFFFFFFFF, name, context); RenderUtils.color(1f, 1f, 1f, 1f); RenderSystem.disableBlend(); - super.render(mouseX, mouseY, selected, matrixStack); - - RenderUtils.disableDiffuseLighting(); + super.render(mouseX, mouseY, selected, context); } @Override - public void postRenderHovered(int mouseX, int mouseY, boolean selected, MatrixStack matrixStack) + public void postRenderHovered(int mouseX, int mouseY, boolean selected, DrawContext context) { - super.postRenderHovered(mouseX, mouseY, selected, matrixStack); + super.postRenderHovered(mouseX, mouseY, selected, context); if (mouseX >= this.x && mouseX < this.buttonsStartX && mouseY >= this.y && mouseY <= this.y + this.height) { - RenderUtils.drawHoverText(mouseX, mouseY, this.hoverLines, matrixStack); + RenderUtils.drawHoverText(mouseX, mouseY, this.hoverLines, context); } } diff --git a/src/main/java/fi/dy/masa/minihud/mixin/MixinSubtitlesHud.java b/src/main/java/fi/dy/masa/minihud/mixin/MixinSubtitlesHud.java index a74aa88..8700bf3 100644 --- a/src/main/java/fi/dy/masa/minihud/mixin/MixinSubtitlesHud.java +++ b/src/main/java/fi/dy/masa/minihud/mixin/MixinSubtitlesHud.java @@ -4,8 +4,10 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.hud.SubtitlesHud; -import net.minecraft.client.util.math.MatrixStack; + import fi.dy.masa.minihud.event.RenderHandler; @Mixin(SubtitlesHud.class) @@ -14,13 +16,13 @@ public abstract class MixinSubtitlesHud @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;scale(FFF)V")) - private void nudgeSubtitleOverlay(MatrixStack matrices, CallbackInfo ci) + private void nudgeSubtitleOverlay(DrawContext context, CallbackInfo ci) { int offset = RenderHandler.getInstance().getSubtitleOffset(); if (offset != 0) { - matrices.translate(0, offset, 0); + context.getMatrices().translate(0, offset, 0); } } } diff --git a/src/main/java/fi/dy/masa/minihud/renderer/RenderObjectVbo.java b/src/main/java/fi/dy/masa/minihud/renderer/RenderObjectVbo.java index 4bc5ba4..31b1c58 100644 --- a/src/main/java/fi/dy/masa/minihud/renderer/RenderObjectVbo.java +++ b/src/main/java/fi/dy/masa/minihud/renderer/RenderObjectVbo.java @@ -20,7 +20,7 @@ public RenderObjectVbo(VertexFormat.DrawMode glMode, VertexFormat format, Suppli { super(glMode, shader); - this.vertexBuffer = new VertexBuffer(); + this.vertexBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC); this.format = format; boolean hasTexture = false; diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 91d73f6..c24a235 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -1,5 +1,5 @@ modLoader = "javafml" -loaderVersion = "[44,)" +loaderVersion = "[46,)" license = "LGPLv3" [[mods]] @@ -19,20 +19,20 @@ Configurable "mini-F3" info lines, and various overlay renderers. [[dependencies.minihud]] modId = "forge" mandatory = true -versionRange = "[44,)" +versionRange = "[46,)" ordering = "NONE" side = "BOTH" [[dependencies.minihud]] modId = "minecraft" mandatory = true -versionRange = "[1.19.3,1.19.4]" +versionRange = "[1.20,]" ordering = "NONE" side = "BOTH" [[dependencies.minihud]] modId = "malilib" mandatory = true -versionRange = "[0.1.4,)" +versionRange = "[0.1.0,)" ordering = "NONE" side = "BOTH"