diff options
Diffstat (limited to 'common/src/main')
3 files changed, 4 insertions, 11 deletions
diff --git a/common/src/main/java/dev/isxander/yacl/gui/ElementListWidgetExt.java b/common/src/main/java/dev/isxander/yacl/gui/ElementListWidgetExt.java index 8fdf2ee..6b3ab1c 100644 --- a/common/src/main/java/dev/isxander/yacl/gui/ElementListWidgetExt.java +++ b/common/src/main/java/dev/isxander/yacl/gui/ElementListWidgetExt.java @@ -67,6 +67,8 @@ public class ElementListWidgetExt<E extends ElementListWidgetExt.Entry<E>> exten this.y0 = rectangle.top(); this.x1 = rectangle.right(); this.y1 = rectangle.bottom(); + this.width = rectangle.width(); + this.height = rectangle.height(); } /** diff --git a/common/src/main/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java b/common/src/main/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java index 08c3275..7dc81fe 100644 --- a/common/src/main/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java +++ b/common/src/main/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java @@ -51,7 +51,7 @@ public class StringControllerElement extends ControllerWidget<IStringController< if (!isHovered()) valueText = Component.literal(GuiUtils.shortenString(valueText.getString(), textRenderer, getMaxUnwrapLength(), "...")).setStyle(valueText.getStyle()); int textX = getDimension().xLimit() - textRenderer.width(valueText) + renderOffset - getXPadding(); - GuiUtils.enableScissor(inputFieldBounds.x(), inputFieldBounds.y() - 2, inputFieldBounds.width() + 1, inputFieldBounds.height() + 4); + graphics.enableScissor(inputFieldBounds.x(), inputFieldBounds.y() - 2, inputFieldBounds.width() + 1, inputFieldBounds.height() + 4); graphics.drawString(textRenderer, valueText, textX, getTextY(), getValueColor(), true); if (isHovered()) { @@ -80,7 +80,7 @@ public class StringControllerElement extends ControllerWidget<IStringController< } } } - RenderSystem.disableScissor(); + graphics.disableScissor(); } @Override diff --git a/common/src/main/java/dev/isxander/yacl/gui/utils/GuiUtils.java b/common/src/main/java/dev/isxander/yacl/gui/utils/GuiUtils.java index aa8bbaa..0e671e8 100644 --- a/common/src/main/java/dev/isxander/yacl/gui/utils/GuiUtils.java +++ b/common/src/main/java/dev/isxander/yacl/gui/utils/GuiUtils.java @@ -1,8 +1,5 @@ package dev.isxander.yacl.gui.utils; -import com.mojang.blaze3d.platform.Window; -import com.mojang.blaze3d.systems.RenderSystem; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.locale.Language; import net.minecraft.network.chat.Component; @@ -15,12 +12,6 @@ public class GuiUtils { return fallback.copy(); } - public static void enableScissor(int x, int y, int width, int height) { - Window window = Minecraft.getInstance().getWindow(); - double d = window.getGuiScale(); - RenderSystem.enableScissor((int)(x * d), (int)((window.getGuiScaledHeight() - y - height) * d), (int)(width * d), (int)(height * d)); - } - public static String shortenString(String string, Font font, int maxWidth, String suffix) { if (string.isEmpty()) return string; |