diff --git a/gradle.properties b/gradle.properties index d43cb10..7bc0b5d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,23 +2,23 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_base_version=1.19.4 -minecraft_version=1.19.4 -yarn_mappings=1.19.4+build.1 -loader_version=0.14.18 +minecraft_base_version=1.20 +minecraft_version=1.20 +yarn_mappings=1.20+build.1 +loader_version=0.14.21 # Mod Properties mod_version=0.4.4 maven_group=com.glisco archives_base_name=isometric-renders # Dependencies # check this on https://modmuss50.me/fabric.html -fabric_version=0.76.0+1.19.4 +fabric_version=0.83.0+1.20 # https://maven.wispforest.io/io/wispforest/worldmesher/ -worldmesher_version=0.3.0+1.19.3 +worldmesher_version=0.3.0+1.20 # https://maven.wispforest.io/io/wispforest/exo/ exo_version=0.1.5+1.19 # https://maven.wispforest.io/io/wispforest/owo-lib/ -owo_version=0.10.3+1.19.4 +owo_version=0.11.0+1.20 diff --git a/src/main/java/com/glisco/isometricrenders/IsometricRenders.java b/src/main/java/com/glisco/isometricrenders/IsometricRenders.java index 9de198b..7e30795 100644 --- a/src/main/java/com/glisco/isometricrenders/IsometricRenders.java +++ b/src/main/java/com/glisco/isometricrenders/IsometricRenders.java @@ -47,13 +47,8 @@ public class IsometricRenders implements ClientModInitializer { public void onInitializeClient() { ClientCommandRegistrationCallback.EVENT.register(IsorenderCommand::register); - ClientLifecycleEvents.CLIENT_STARTED.register(newClient -> { - TooltipRenderable.TooltipScreen.INSTANCE.init(newClient, 10000, 10000); - }); - KeyBindingHelper.registerKeyBinding(SELECT); - final var ioStateId = "io-state"; final var areaSelectionHintId = "area-selection-hint"; diff --git a/src/main/java/com/glisco/isometricrenders/command/IsorenderCommand.java b/src/main/java/com/glisco/isometricrenders/command/IsorenderCommand.java index 352b9af..f48e3bb 100644 --- a/src/main/java/com/glisco/isometricrenders/command/IsorenderCommand.java +++ b/src/main/java/com/glisco/isometricrenders/command/IsorenderCommand.java @@ -331,7 +331,7 @@ private static int renderAreaSelection(CommandContext private static void withItemGroupFromContext(CommandContext context, BiConsumer, String> action) { final var itemGroup = ItemGroupArgumentType.getItemGroup("itemgroup", context); final var stacks = new ArrayList<>(itemGroup.getDisplayStacks()); - action.accept(stacks, "creative-tab_" + itemGroup.getId().toShortTranslationKey()); + action.accept(stacks, "creative-tab_" + Registries.ITEM_GROUP.getId(itemGroup).toShortTranslationKey()); } public static BlockPos getPosFromArgument(DefaultPosArgument argument, FabricClientCommandSource source) { diff --git a/src/main/java/com/glisco/isometricrenders/command/ItemGroupArgumentType.java b/src/main/java/com/glisco/isometricrenders/command/ItemGroupArgumentType.java index eae98d7..7249fd1 100644 --- a/src/main/java/com/glisco/isometricrenders/command/ItemGroupArgumentType.java +++ b/src/main/java/com/glisco/isometricrenders/command/ItemGroupArgumentType.java @@ -10,6 +10,7 @@ import net.minecraft.command.CommandSource; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroups; +import net.minecraft.registry.Registries; import net.minecraft.util.Identifier; import java.util.concurrent.CompletableFuture; @@ -31,11 +32,11 @@ public static ItemGroup getItemGroup(String name, CommandContext context) @Override public ItemGroup parse(StringReader reader) throws CommandSyntaxException { var id = Identifier.fromCommandInput(reader); - return ItemGroups.getGroups().stream().filter(itemGroup -> itemGroup.getId().equals(id)).findAny().orElseThrow(() -> NO_ITEMGROUP.create(id)); + return ItemGroups.getGroups().stream().filter(itemGroup -> Registries.ITEM_GROUP.getId(itemGroup).equals(id)).findAny().orElseThrow(() -> NO_ITEMGROUP.create(id)); } @Override public CompletableFuture listSuggestions(CommandContext context, SuggestionsBuilder builder) { - return CommandSource.suggestIdentifiers(ItemGroups.getGroups().stream().map(ItemGroup::getId), builder); + return CommandSource.suggestIdentifiers(ItemGroups.getGroups().stream().map(Registries.ITEM_GROUP::getId), builder); } } diff --git a/src/main/java/com/glisco/isometricrenders/mixin/DrawContextMixin.java b/src/main/java/com/glisco/isometricrenders/mixin/DrawContextMixin.java new file mode 100644 index 0000000..c0f69ea --- /dev/null +++ b/src/main/java/com/glisco/isometricrenders/mixin/DrawContextMixin.java @@ -0,0 +1,49 @@ +package com.glisco.isometricrenders.mixin; + +import com.glisco.isometricrenders.IsometricRenders; +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.tooltip.TooltipComponent; +import net.minecraft.client.gui.tooltip.TooltipPositioner; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyVariable; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; + +import java.util.List; + +@Mixin(DrawContext.class) +public class DrawContextMixin { + + @Unique + private int isometric$tooltipWidth = 0; + @Unique + private int isometric$tooltipHeight = 0; + + @Inject(method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;IILnet/minecraft/client/gui/tooltip/TooltipPositioner;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;push()V"), locals = LocalCapture.CAPTURE_FAILHARD) + private void captureTooltipDimensions(TextRenderer textRenderer, List components, int x, int y, TooltipPositioner positioner, CallbackInfo ci, int width, int height) { + this.isometric$tooltipWidth = width; + this.isometric$tooltipHeight = height; + } + + @ModifyVariable(method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;IILnet/minecraft/client/gui/tooltip/TooltipPositioner;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;push()V"), ordinal = 6) + private int centerXIfNeeded(int orig) { + if (!IsometricRenders.centerNextTooltip) return orig; + return orig - 12 - isometric$tooltipWidth / 2; + } + + @ModifyVariable(method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;IILnet/minecraft/client/gui/tooltip/TooltipPositioner;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;push()V"), ordinal = 7) + private int centerYIfNeeded(int orig) { + if (!IsometricRenders.centerNextTooltip) return orig; + return orig + 12 - isometric$tooltipHeight / 2; + } + + @Inject(method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;IILnet/minecraft/client/gui/tooltip/TooltipPositioner;)V", at = @At("TAIL")) + private void resetCenterState(TextRenderer textRenderer, List components, int x, int y, TooltipPositioner positioner, CallbackInfo ci) { + IsometricRenders.centerNextTooltip = false; + } + +} diff --git a/src/main/java/com/glisco/isometricrenders/mixin/ScreenMixin.java b/src/main/java/com/glisco/isometricrenders/mixin/ScreenMixin.java deleted file mode 100644 index 15215e7..0000000 --- a/src/main/java/com/glisco/isometricrenders/mixin/ScreenMixin.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.glisco.isometricrenders.mixin; - -import com.glisco.isometricrenders.IsometricRenders; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.tooltip.TooltipComponent; -import net.minecraft.client.gui.tooltip.TooltipPositioner; -import net.minecraft.client.util.math.MatrixStack; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyVariable; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; - -import java.util.List; - -@Mixin(Screen.class) -public class ScreenMixin { - - @Unique private int isometric$tooltipWidth = 0; - @Unique private int isometric$tooltipHeight = 0; - - @Inject(method = "renderTooltipFromComponents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;push()V"), locals = LocalCapture.CAPTURE_FAILHARD) - private void captureTooltipDimensions(MatrixStack matrices, List components, int x, int y, TooltipPositioner positioner, CallbackInfo ci, int width, int height) { - this.isometric$tooltipWidth = width; - this.isometric$tooltipHeight = height; - } - - @ModifyVariable(method = "renderTooltipFromComponents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;push()V"), ordinal = 6) - private int centerXIfNeeded(int orig) { - if (!IsometricRenders.centerNextTooltip) return orig; - return orig - 12 - isometric$tooltipWidth / 2; - } - - @ModifyVariable(method = "renderTooltipFromComponents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;push()V"), ordinal = 7) - private int centerYIfNeeded(int orig) { - if (!IsometricRenders.centerNextTooltip) return orig; - return orig + 12 - isometric$tooltipHeight / 2; - } - - @Inject(method = "renderTooltipFromComponents", at = @At("TAIL")) - private void resetCenterState(MatrixStack matrices, List components, int x, int y, TooltipPositioner positioner, CallbackInfo ci) { - IsometricRenders.centerNextTooltip = false; - } - -} diff --git a/src/main/java/com/glisco/isometricrenders/render/RenderableDispatcher.java b/src/main/java/com/glisco/isometricrenders/render/RenderableDispatcher.java index 9f37ae1..080b387 100644 --- a/src/main/java/com/glisco/isometricrenders/render/RenderableDispatcher.java +++ b/src/main/java/com/glisco/isometricrenders/render/RenderableDispatcher.java @@ -5,6 +5,7 @@ import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.TextureUtil; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.systems.VertexSorter; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gl.Framebuffer; import net.minecraft.client.gl.SimpleFramebuffer; @@ -28,7 +29,7 @@ public class RenderableDispatcher { public static void drawIntoActiveFramebuffer(Renderable renderable, float aspectRatio, float tickDelta, Consumer transformer) { RenderSystem.backupProjectionMatrix(); Matrix4f projectionMatrix = new Matrix4f().setOrtho(-aspectRatio, aspectRatio, -1, 1, -1000, 3000); - RenderSystem.setProjectionMatrix(projectionMatrix); + RenderSystem.setProjectionMatrix(projectionMatrix, VertexSorter.BY_Z); renderable.prepare(); diff --git a/src/main/java/com/glisco/isometricrenders/render/TooltipRenderable.java b/src/main/java/com/glisco/isometricrenders/render/TooltipRenderable.java index 3857aa3..5893134 100644 --- a/src/main/java/com/glisco/isometricrenders/render/TooltipRenderable.java +++ b/src/main/java/com/glisco/isometricrenders/render/TooltipRenderable.java @@ -5,12 +5,12 @@ import com.glisco.isometricrenders.screen.IsometricUI; import com.glisco.isometricrenders.util.ExportPathSpec; import io.wispforest.owo.ui.container.FlowLayout; -import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; import net.minecraft.registry.Registries; -import net.minecraft.text.Text; import net.minecraft.util.math.RotationAxis; public class TooltipRenderable extends DefaultRenderable { @@ -24,7 +24,10 @@ public TooltipRenderable(ItemStack stack) { @Override public void emitVertices(MatrixStack matrices, VertexConsumerProvider vertexConsumers, float tickDelta) { IsometricRenders.centerNextTooltip = true; - TooltipScreen.INSTANCE.renderTooltip(matrices, this.stack, 0, 0); + + var client = MinecraftClient.getInstance(); + new DrawContext(client, client.getBufferBuilders().getEntityVertexConsumers()) + .drawItemTooltip(client.textRenderer, this.stack, 0, 0); } @Override @@ -56,18 +59,4 @@ public void applyToViewMatrix(MatrixStack modelViewStack) { modelViewStack.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(180)); } } - - public static class TooltipScreen extends Screen { - - public static final TooltipScreen INSTANCE = new TooltipScreen(); - - private TooltipScreen() { - super(Text.empty()); - } - - @Override - public void renderTooltip(MatrixStack matrices, ItemStack stack, int x, int y) { - super.renderTooltip(matrices, stack, x, y); - } - } } diff --git a/src/main/java/com/glisco/isometricrenders/screen/IsometricUI.java b/src/main/java/com/glisco/isometricrenders/screen/IsometricUI.java index 44b58af..e029e79 100644 --- a/src/main/java/com/glisco/isometricrenders/screen/IsometricUI.java +++ b/src/main/java/com/glisco/isometricrenders/screen/IsometricUI.java @@ -14,9 +14,8 @@ import io.wispforest.owo.ui.core.Insets; import io.wispforest.owo.ui.core.Sizing; import io.wispforest.owo.ui.core.VerticalAlignment; -import io.wispforest.owo.ui.util.Drawer; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.widget.TextFieldWidget; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import java.util.function.Supplier; @@ -62,7 +61,7 @@ public static void intControl(FlowLayout container, IntProperty property, String } } - public static void drawExportProgressBar(MatrixStack matrices, int x, int y, int drawWidth, int barWidth, double speed) { + public static void drawExportProgressBar(DrawContext context, int x, int y, int drawWidth, int barWidth, double speed) { int end = x + drawWidth + barWidth; int offset = (int) (System.currentTimeMillis() / speed % (drawWidth + barWidth)); @@ -70,7 +69,7 @@ public static void drawExportProgressBar(MatrixStack matrices, int x, int y, int int endWithOffset = x + offset; if (endWithOffset > end) endWithOffset = end; - Drawer.fill(matrices, Math.max(x + offset - barWidth, x), y, Math.min(endWithOffset, x + drawWidth), y + 2, 0xFF00FF00); + context.fill(Math.max(x + offset - barWidth, x), y, Math.min(endWithOffset, x + drawWidth), y + 2, 0xFF00FF00); } public static RowBuilder row(FlowLayout container) { diff --git a/src/main/java/com/glisco/isometricrenders/screen/RenderScreen.java b/src/main/java/com/glisco/isometricrenders/screen/RenderScreen.java index 0072899..a77eea4 100644 --- a/src/main/java/com/glisco/isometricrenders/screen/RenderScreen.java +++ b/src/main/java/com/glisco/isometricrenders/screen/RenderScreen.java @@ -25,6 +25,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gl.Framebuffer; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.ConfirmLinkScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.tooltip.TooltipComponent; @@ -303,7 +304,7 @@ protected void build(FlowLayout rootComponent) { } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { + public void render(DrawContext context, int mouseX, int mouseY, float delta) { if (this.guiRebuildScheduled) { this.guiRebuildScheduled = false; @@ -316,9 +317,9 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { } if (this.drawOnlyBackground) { - fill(matrices, 0, 0, this.width, this.height, GlobalProperties.backgroundColor | 255 << 24); + context.fill(0, 0, this.width, this.height, GlobalProperties.backgroundColor | 255 << 24); } else { - renderBackground(matrices); + renderBackground(context); } final var window = client.getWindow(); @@ -333,11 +334,11 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { ); if (!this.drawOnlyBackground && this.uiAdapter != null) { - drawFramingHint(matrices); - drawGuiBackground(matrices); + drawFramingHint(context); + drawGuiBackground(context); RenderSystem.clear(GL11.GL_DEPTH_BUFFER_BIT, MinecraftClient.IS_SYSTEM_MAC); - super.render(matrices, mouseX, mouseY, delta); + super.render(context, mouseX, mouseY, delta); if (this.exportAnimationButton != null) { this.exportAnimationButton.tooltip(this.memoryGuard.getStatusTooltip(this.estimateMemoryUsage(exportFrames)).stream().map(text -> TooltipComponent.of(text.asOrderedText())).toList()); @@ -545,15 +546,15 @@ public void removed() { this.client.getWindow().setFramerateLimit(this.client.options.getMaxFps().getValue()); } - private void drawFramingHint(MatrixStack matrices) { - fill(matrices, viewportBeginX + 5, 0, viewportEndX - 5, 5, 0x90000000); - fill(matrices, viewportBeginX + 5, height - 5, viewportEndX - 5, height, 0x90000000); - fill(matrices, viewportBeginX, 0, viewportBeginX + 5, height, 0x90000000); - fill(matrices, viewportEndX - 5, 0, viewportEndX, height, 0x90000000); + private void drawFramingHint(DrawContext context) { + context.fill(viewportBeginX + 5, 0, viewportEndX - 5, 5, 0x90000000); + context.fill(viewportBeginX + 5, height - 5, viewportEndX - 5, height, 0x90000000); + context.fill(viewportBeginX, 0, viewportBeginX + 5, height, 0x90000000); + context.fill(viewportEndX - 5, 0, viewportEndX, height, 0x90000000); } - private void drawGuiBackground(MatrixStack matrices) { - fill(matrices, 0, 0, viewportBeginX, height, 0x90000000); - fill(matrices, viewportEndX, 0, width, height, 0x90000000); + private void drawGuiBackground(DrawContext context) { + context.fill(0, 0, viewportBeginX, height, 0x90000000); + context.fill(viewportEndX, 0, width, height, 0x90000000); } } diff --git a/src/main/java/com/glisco/isometricrenders/widget/AreaSelectionComponent.java b/src/main/java/com/glisco/isometricrenders/widget/AreaSelectionComponent.java index c060857..063a70f 100644 --- a/src/main/java/com/glisco/isometricrenders/widget/AreaSelectionComponent.java +++ b/src/main/java/com/glisco/isometricrenders/widget/AreaSelectionComponent.java @@ -2,7 +2,7 @@ import com.glisco.isometricrenders.util.Translate; import io.wispforest.owo.ui.component.Components; -import io.wispforest.owo.ui.container.VerticalFlowLayout; +import io.wispforest.owo.ui.container.FlowLayout; import io.wispforest.owo.ui.core.Insets; import io.wispforest.owo.ui.core.Sizing; import io.wispforest.owo.ui.core.Surface; @@ -15,10 +15,10 @@ import static com.glisco.isometricrenders.util.AreaSelectionHelper.pos1; import static com.glisco.isometricrenders.util.AreaSelectionHelper.pos2; -public class AreaSelectionComponent extends VerticalFlowLayout { +public class AreaSelectionComponent extends FlowLayout { public AreaSelectionComponent() { - super(Sizing.content(), Sizing.content()); + super(Sizing.content(), Sizing.content(), Algorithm.VERTICAL); this.surface(Surface.flat(0x77000000).and(Surface.outline(0x77000000))); this.padding(Insets.of(5)); diff --git a/src/main/java/com/glisco/isometricrenders/widget/DynamicLabelComponent.java b/src/main/java/com/glisco/isometricrenders/widget/DynamicLabelComponent.java index 552dae4..d7243af 100644 --- a/src/main/java/com/glisco/isometricrenders/widget/DynamicLabelComponent.java +++ b/src/main/java/com/glisco/isometricrenders/widget/DynamicLabelComponent.java @@ -1,10 +1,10 @@ package com.glisco.isometricrenders.widget; import io.wispforest.owo.ui.base.BaseComponent; +import io.wispforest.owo.ui.core.OwoUIDrawContext; import io.wispforest.owo.ui.core.Sizing; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import java.util.function.Supplier; @@ -42,13 +42,7 @@ protected int determineVerticalContentSize(Sizing sizing) { } @Override - public void draw(MatrixStack matrices, int mouseX, int mouseY, float partialTicks, float delta) { - if (this.shadow) { - this.textRenderer.drawWithShadow(matrices, this.content.get(), this.x, this.y, this.color); - } else { - this.textRenderer.draw(matrices, this.content.get(), this.x, this.y, this.color); - } + public void draw(OwoUIDrawContext context, int mouseX, int mouseY, float partialTicks, float delta) { + context.drawText(this.textRenderer, this.content.get(), this.x, this.y, this.color, this.shadow); } - - } diff --git a/src/main/java/com/glisco/isometricrenders/widget/IOStateComponent.java b/src/main/java/com/glisco/isometricrenders/widget/IOStateComponent.java index 06b0ceb..2473730 100644 --- a/src/main/java/com/glisco/isometricrenders/widget/IOStateComponent.java +++ b/src/main/java/com/glisco/isometricrenders/widget/IOStateComponent.java @@ -2,16 +2,17 @@ import com.glisco.isometricrenders.screen.IsometricUI; import com.glisco.isometricrenders.util.ImageIO; -import io.wispforest.owo.ui.container.VerticalFlowLayout; +import io.wispforest.owo.ui.container.FlowLayout; import io.wispforest.owo.ui.core.Insets; +import io.wispforest.owo.ui.core.OwoUIDrawContext; import io.wispforest.owo.ui.core.Sizing; import io.wispforest.owo.ui.core.Surface; import net.minecraft.client.util.math.MatrixStack; -public class IOStateComponent extends VerticalFlowLayout { +public class IOStateComponent extends FlowLayout { public IOStateComponent() { - super(Sizing.content(), Sizing.content()); + super(Sizing.content(), Sizing.content(), Algorithm.VERTICAL); this.padding(Insets.of(10)); this.surface(Surface.flat(0x77000000).and(Surface.outline(0x77000000))); @@ -20,8 +21,8 @@ public IOStateComponent() { } @Override - public void draw(MatrixStack matrices, int mouseX, int mouseY, float partialTicks, float delta) { - super.draw(matrices, mouseX, mouseY, partialTicks, delta); - IsometricUI.drawExportProgressBar(matrices, this.x + 10, this.y + 25, 100, 50, 10); + public void draw(OwoUIDrawContext context, int mouseX, int mouseY, float partialTicks, float delta) { + super.draw(context, mouseX, mouseY, partialTicks, delta); + IsometricUI.drawExportProgressBar(context, this.x + 10, this.y + 25, 100, 50, 10); } } diff --git a/src/main/java/com/glisco/isometricrenders/widget/NotificationComponent.java b/src/main/java/com/glisco/isometricrenders/widget/NotificationComponent.java index 9f22e50..0114a31 100644 --- a/src/main/java/com/glisco/isometricrenders/widget/NotificationComponent.java +++ b/src/main/java/com/glisco/isometricrenders/widget/NotificationComponent.java @@ -2,19 +2,19 @@ import com.glisco.isometricrenders.util.Translate; import io.wispforest.owo.ui.component.Components; -import io.wispforest.owo.ui.container.VerticalFlowLayout; +import io.wispforest.owo.ui.container.FlowLayout; import io.wispforest.owo.ui.core.*; import io.wispforest.owo.ui.util.UISounds; import net.minecraft.text.Text; import org.jetbrains.annotations.Nullable; import org.lwjgl.glfw.GLFW; -public class NotificationComponent extends VerticalFlowLayout { +public class NotificationComponent extends FlowLayout { private float age = 0; public NotificationComponent(@Nullable Runnable onClick, Text... messages) { - super(Sizing.content(), Sizing.content()); + super(Sizing.content(), Sizing.content(), Algorithm.VERTICAL); this.margins(Insets.top(5)); this.padding(Insets.of(10)); diff --git a/src/main/java/com/glisco/isometricrenders/widget/PropertyCheckboxComponent.java b/src/main/java/com/glisco/isometricrenders/widget/PropertyCheckboxComponent.java index 7aa7a48..8aaf872 100644 --- a/src/main/java/com/glisco/isometricrenders/widget/PropertyCheckboxComponent.java +++ b/src/main/java/com/glisco/isometricrenders/widget/PropertyCheckboxComponent.java @@ -2,8 +2,8 @@ import com.glisco.isometricrenders.property.Property; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.widget.CheckboxWidget; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; public class PropertyCheckboxComponent extends CheckboxWidget { @@ -16,20 +16,20 @@ public PropertyCheckboxComponent(Text message, Property property) { } @Override - public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta) { - super.renderButton(matrices, mouseX, mouseY, delta); - MinecraftClient.getInstance().textRenderer.draw( - matrices, + public void renderButton(DrawContext context, int mouseX, int mouseY, float delta) { + super.renderButton(context, mouseX, mouseY, delta); + context.drawText( + MinecraftClient.getInstance().textRenderer, this.getMessage(), this.getX() + 24, - this.getY() + (this.height - 8) / 2f, - 0xAAAAAA + (int) (this.getY() + (this.height - 8) / 2f), + 0xAAAAAA, false ); } @Override public void onPress() { super.onPress(); - property.set(isChecked()); + property.set(this.isChecked()); } } diff --git a/src/main/resources/assets/isometric-renders/lang/en_us.json b/src/main/resources/assets/isometric-renders/lang/en_us.json index 68ee147..aa8c754 100644 --- a/src/main/resources/assets/isometric-renders/lang/en_us.json +++ b/src/main/resources/assets/isometric-renders/lang/en_us.json @@ -117,7 +117,7 @@ "message.isometric-renders.no_block": "You're not looking at a block", "message.isometric-renders.no_entity": "You're not looking at an entity", - "message.isometric-renders.incomplete_selection": "Your do not have a completed area", + "message.isometric-renders.incomplete_selection": "You do not have a completed area", "message.isometric-renders.no_such_namespace": "Unknown namespace", "message.isometric-renders.player_rendering_in_multiplayer": "Rendering players by names is only supported in Singleplayer", diff --git a/src/main/resources/isometric-renders.mixins.json b/src/main/resources/isometric-renders.mixins.json index 320a785..f7625d9 100644 --- a/src/main/resources/isometric-renders.mixins.json +++ b/src/main/resources/isometric-renders.mixins.json @@ -9,7 +9,7 @@ "LivingEntityRendererMixin", "MinecraftClientMixin", "ParticleManagerMixin", - "ScreenMixin", + "DrawContextMixin", "SliderWidgetInvoker", "TextureManagerMixin", "WorldRendererMixin",