diff options
| author | shedaniel <daniel@shedaniel.me> | 2024-04-16 01:34:03 +0900 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2024-04-16 01:34:03 +0900 |
| commit | 8981a2f730942e169ba5efa2f25ad3066dc0f797 (patch) | |
| tree | 5c6117978c8525d319934bf5be110e96f3a3705d /runtime | |
| parent | 6788d2b65edfd1b24f84bd92fbf66ec4098537d6 (diff) | |
| download | RoughlyEnoughItems-8981a2f730942e169ba5efa2f25ad3066dc0f797.tar.gz RoughlyEnoughItems-8981a2f730942e169ba5efa2f25ad3066dc0f797.tar.bz2 RoughlyEnoughItems-8981a2f730942e169ba5efa2f25ad3066dc0f797.zip | |
Fix merge conflicts
Diffstat (limited to 'runtime')
26 files changed, 242 insertions, 239 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ConfigureCategoriesScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ConfigureCategoriesScreen.java index 229c8dba0..3199e2575 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ConfigureCategoriesScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ConfigureCategoriesScreen.java @@ -280,22 +280,22 @@ public class ConfigureCategoriesScreen extends Screen { { Component subtitle = Component.translatable("config.roughlyenoughitems.configureCategories.visibility." + shown) .withStyle(shown ? ChatFormatting.GREEN : ChatFormatting.RED); - int i = client.font.drawShadow(matrices, subtitle.getVisualOrderText(), xPos, y + 22, 8421504); + int i = graphics.drawString(client.font, subtitle.getVisualOrderText(), xPos, y + 22, 8421504); visibilityToggleButton.getPoint().setLocation(i + 3, y + 22); - visibilityToggleButton.render(matrices, mouseX, mouseY, delta); + visibilityToggleButton.render(graphics, mouseX, mouseY, delta); } if (shown) { Component subtitle = Component.translatable("config.roughlyenoughitems.filtering.filteringQuickCraftCategories.configure." + filteringQuickCraftCategories.getOrDefault(configuration.getCategoryIdentifier(), configuration.isQuickCraftingEnabledByDefault())) .withStyle(ChatFormatting.GRAY); - int i = client.font.drawShadow(matrices, subtitle.getVisualOrderText(), xPos, y + 32, 8421504); + int i = graphics.drawString(client.font, subtitle.getVisualOrderText(), xPos, y + 32, 8421504); quickCraftToggleButton.getPoint().setLocation(i + 3, y + 32); - quickCraftToggleButton.render(matrices, mouseX, mouseY, delta); + quickCraftToggleButton.render(graphics, mouseX, mouseY, delta); } else { quickCraftToggleButton.getPoint().setLocation(-12390, -12390); } upButton.setX(x + entryWidth - 20); upButton.setY(y + entryHeight / 2 - 21); - upButton.render(matrices, mouseX, mouseY, delta); + upButton.render(graphics, mouseX, mouseY, delta); downButton.setX(x + entryWidth - 20); downButton.setY(y + entryHeight / 2 + 1); downButton.render(graphics, mouseX, mouseY, delta); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/REIConfigScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/REIConfigScreen.java index 6ce0d98c8..d1cdccd00 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/REIConfigScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/REIConfigScreen.java @@ -25,7 +25,6 @@ package me.shedaniel.rei.impl.client.gui.config; import com.google.common.base.Preconditions; import com.mojang.blaze3d.platform.InputConstants; -import com.mojang.blaze3d.vertex.PoseStack; import dev.architectury.utils.value.IntValue; import me.shedaniel.clothconfig2.api.Modifier; import me.shedaniel.clothconfig2.api.ModifierKeyCode; @@ -54,7 +53,7 @@ import me.shedaniel.rei.impl.client.gui.widget.HoleWidget; import me.shedaniel.rei.impl.client.gui.widget.basewidgets.TextFieldWidget; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.resources.language.I18n; @@ -142,27 +141,27 @@ public class REIConfigScreen extends Screen implements ConfigAccess { this.widgets.add(HoleWidget.createBackground(new Rectangle(8 + sideWidth + 4, 32, width - 16 - sideWidth - 4, 20), () -> 0, 32)); TextFieldWidget textField = new TextFieldWidget(new Rectangle(8 + sideWidth + 4 + 6, 32 + 6, width - 16 - sideWidth - 4 - 10, 12)) { @Override - protected void renderSuggestion(PoseStack matrices, int x, int y) { + protected void renderSuggestion(GuiGraphics graphics, int x, int y) { int color; if (containsMouse(PointHelper.ofMouse()) || isFocused()) { color = 0xddeaeaea; } else { color = -6250336; } - this.font.drawShadow(matrices, this.font.plainSubstrByWidth(this.getSuggestion(), this.getWidth()), x, y, color); + graphics.drawString(this.font, this.font.plainSubstrByWidth(this.getSuggestion(), this.getWidth()), x, y, color); } }; textField.setHasBorder(false); textField.setMaxLength(9000); this.widgets.add(textField); - this.widgets.add(Widgets.createDrawableWidget((helper, matrices, mouseX, mouseY, delta) -> { + this.widgets.add(Widgets.createDrawableWidget((graphics, mouseX, mouseY, delta) -> { textField.setSuggestion(!textField.isFocused() && textField.getText().isEmpty() ? I18n.get("config.rei.texts.search_options") : null); if (!textField.isFocused()) return; Rectangle bounds = textField.getBounds(); - GuiComponent.fill(matrices, bounds.x - 6, bounds.y - 6, bounds.getMaxX() + 4, bounds.y - 5, 0xffe0e0e0); - GuiComponent.fill(matrices, bounds.x - 6, bounds.getMaxY() + 1, bounds.getMaxX() + 4, bounds.getMaxY() + 2, 0xffe0e0e0); - GuiComponent.fill(matrices, bounds.x - 6, bounds.y - 6, bounds.x - 7, bounds.getMaxY() + 2, 0xffe0e0e0); - GuiComponent.fill(matrices, bounds.getMaxX() + 3, bounds.y - 6, bounds.getMaxX() + 4, bounds.getMaxY() + 2, 0xffe0e0e0); + graphics.fill(bounds.x - 6, bounds.y - 6, bounds.getMaxX() + 4, bounds.y - 5, 0xffe0e0e0); + graphics.fill(bounds.x - 6, bounds.getMaxY() + 1, bounds.getMaxX() + 4, bounds.getMaxY() + 2, 0xffe0e0e0); + graphics.fill(bounds.x - 6, bounds.y - 6, bounds.x - 7, bounds.getMaxY() + 2, 0xffe0e0e0); + graphics.fill(bounds.getMaxX() + 3, bounds.y - 6, bounds.getMaxX() + 4, bounds.getMaxY() + 2, 0xffe0e0e0); })); this.widgets.add(ConfigSearchListWidget.create(this, this.categories, textField, new Rectangle(8, 32 + 20 + 4, width - 16, height - 32 - (32 + 20 + 4)))); } else { @@ -224,13 +223,13 @@ public class REIConfigScreen extends Screen implements ConfigAccess { } @Override - public void render(PoseStack poses, int mouseX, int mouseY, float delta) { - this.renderDirtBackground(poses); - super.render(poses, mouseX, mouseY, delta); + public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { + this.renderDirtBackground(graphics); + super.render(graphics, mouseX, mouseY, delta); for (Widget widget : widgets) { - widget.render(poses, mouseX, mouseY, delta); + widget.render(graphics, mouseX, mouseY, delta); } - ScreenOverlayImpl.getInstance().lateRender(poses, mouseX, mouseY, delta); + ScreenOverlayImpl.getInstance().lateRender(graphics, mouseX, mouseY, delta); } @Override diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoryEntryWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoryEntryWidget.java index e682dbe23..e6f7332ae 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoryEntryWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoryEntryWidget.java @@ -23,7 +23,6 @@ package me.shedaniel.rei.impl.client.gui.config.components; -import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.gui.widgets.*; @@ -33,6 +32,7 @@ import me.shedaniel.rei.impl.client.gui.config.options.OptionCategory; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.util.FormattedCharSequence; @@ -47,8 +47,8 @@ public class ConfigCategoryEntryWidget { .leftAligned(); Font font = Minecraft.getInstance().font; MutableComponent description = category.getDescription().copy().withStyle(style -> style.withColor(0xFF909090)); - Widget descriptionLabel = Widgets.createDrawableWidget((helper, matrices, mouseX, mouseY, delta) -> { - renderTextScrolling(matrices, description, 0, 0, (int) ((width - 21 - 6) / 0.75), 0xFF909090); + Widget descriptionLabel = Widgets.createDrawableWidget((graphics, mouseX, mouseY, delta) -> { + renderTextScrolling(graphics, description, 0, 0, (int) ((width - 21 - 6) / 0.75), 0xFF909090); }); Rectangle bounds = new Rectangle(0, 0, label.getBounds().getMaxX(), hasDescription ? 24 : 7 * 3); return Widgets.concatWithBounds( @@ -69,25 +69,25 @@ public class ConfigCategoryEntryWidget { ); } - private static void renderTextScrolling(PoseStack poses, Component text, int x, int y, int width, int color) { - renderTextScrolling(poses, text.getVisualOrderText(), x, y, width, color); + private static void renderTextScrolling(GuiGraphics graphics, Component text, int x, int y, int width, int color) { + renderTextScrolling(graphics, text.getVisualOrderText(), x, y, width, color); } - private static void renderTextScrolling(PoseStack poses, FormattedCharSequence text, int x, int y, int width, int color) { - try (CloseableScissors scissors = scissor(poses, new Rectangle(x, y, width, y + 9))) { + private static void renderTextScrolling(GuiGraphics graphics, FormattedCharSequence text, int x, int y, int width, int color) { + try (CloseableScissors scissors = scissor(graphics, new Rectangle(x, y, width, y + 9))) { Font font = Minecraft.getInstance().font; int textWidth = font.width(text); - textWidth = MatrixUtils.transform(MatrixUtils.inverse(poses.last().pose()), new Rectangle(0, 0, textWidth, 100)).width; - width = MatrixUtils.transform(MatrixUtils.inverse(poses.last().pose()), new Rectangle(0, 0, width, 100)).width; + textWidth = MatrixUtils.transform(MatrixUtils.inverse(graphics.pose().last().pose()), new Rectangle(0, 0, textWidth, 100)).width; + width = MatrixUtils.transform(MatrixUtils.inverse(graphics.pose().last().pose()), new Rectangle(0, 0, width, 100)).width; if (textWidth > width && !ConfigUtils.isReducedMotion()) { - poses.pushPose(); + graphics.pose().pushPose(); float textX = (System.currentTimeMillis() % ((textWidth + 10) * textWidth / 3)) / (float) textWidth * 3; - poses.translate(-textX, 0, 0); - font.drawShadow(poses, text, x + width - textWidth - 10, y, color); - font.drawShadow(poses, text, x + width, y, color); - poses.popPose(); + graphics.pose().translate(-textX, 0, 0); + graphics.drawString(font, text, x + width - textWidth - 10, y, color); + graphics.drawString(font, text, x + width, y, color); + graphics.pose().popPose(); } else { - font.drawShadow(poses, text, x, y, color); + graphics.drawString(font, text, x, y, color); } } } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigGroupWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigGroupWidget.java index 161a38f69..c5ad01340 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigGroupWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigGroupWidget.java @@ -37,7 +37,6 @@ import me.shedaniel.rei.impl.client.gui.config.options.preview.AccessibilityDisp import me.shedaniel.rei.impl.client.gui.config.options.preview.InterfacePreviewer; import me.shedaniel.rei.impl.client.gui.config.options.preview.TooltipPreviewer; import me.shedaniel.rei.impl.client.gui.text.TextTransformations; -import net.minecraft.client.gui.GuiComponent; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.Nullable; import org.joml.Matrix4f; @@ -110,16 +109,16 @@ public class ConfigGroupWidget { widgets.add(WidgetComposite.of(ConfigOptionWidget.create(access, option, width))); if (entry.getOptions().get(entry.getOptions().size() - 1) != option) { - Widget separator = Widgets.createDrawableWidget((helper, matrices, mouseX, mouseY, delta) -> { + Widget separator = Widgets.createDrawableWidget((graphics, mouseX, mouseY, delta) -> { for (int x = 0; x <= width; x += 4) { - GuiComponent.fill(matrices, Math.min(width, x), 1, Math.min(width, x + 2), 2, 0xFF757575); + graphics.fill(Math.min(width, x), 1, Math.min(width, x + 2), 2, 0xFF757575); } }); widgets.add(WidgetComposite.of(Widgets.withBounds(separator, new Rectangle(0, 0, 1, 7)))); } } - widgets.add(WidgetComposite.ofNonAccounting(Widgets.createDrawableWidget((helper, matrices, mouseX, mouseY, delta) -> { + widgets.add(WidgetComposite.ofNonAccounting(Widgets.createDrawableWidget((graphics, mouseX, mouseY, delta) -> { recalculateHeight(widgets, i -> height[0] = i); }))); recalculateHeight(widgets, i -> height[0] = i); @@ -172,10 +171,10 @@ public class ConfigGroupWidget { } private static Widget createBackgroundSlot(Supplier<Rectangle> bounds) { - return Widgets.createDrawableWidget((helper, matrices, mouseX, mouseY, delta) -> { + return Widgets.createDrawableWidget((graphics, mouseX, mouseY, delta) -> { Rectangle rectangle = bounds.get(); - GuiComponent.fill(matrices, rectangle.x, rectangle.y, rectangle.getMaxX(), rectangle.getMaxY(), 0xFF333333); - GuiComponent.fill(matrices, rectangle.x + 1, rectangle.y + 1, rectangle.getMaxX() - 1, rectangle.getMaxY() - 1, 0xFF000000); + graphics.fill(rectangle.x, rectangle.y, rectangle.getMaxX(), rectangle.getMaxY(), 0xFF333333); + graphics.fill(rectangle.x + 1, rectangle.y + 1, rectangle.getMaxX() - 1, rectangle.getMaxY() - 1, 0xFF000000); }); } } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionValueWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionValueWidget.java index 7d605ccbe..a469a95b5 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionValueWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionValueWidget.java @@ -23,7 +23,6 @@ package me.shedaniel.rei.impl.client.gui.config.components; -import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.clothconfig2.api.ModifierKeyCode; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; @@ -42,6 +41,7 @@ import me.shedaniel.rei.impl.client.gui.modules.entries.ToggleMenuEntry; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; @@ -113,7 +113,7 @@ public class ConfigOptionValueWidget { return Widgets.concatWithBounds(() -> new Rectangle(-label.getBounds().width, 0, label.getBounds().width + 8, 14), label, - Widgets.createDrawableWidget((helper, matrices, mouseX, mouseY, delta) -> matrix[0] = matrices.last().pose()), + Widgets.createDrawableWidget((graphics, mouseX, mouseY, delta) -> matrix[0] = graphics.pose().last().pose()), Widgets.withTranslate(Widgets.createTexturedWidget(new ResourceLocation("roughlyenoughitems:textures/gui/config/selector.png"), new Rectangle(1, 1, 4, 6), 0, 0, 1, 1, 1, 1), 0, 0.5, 0) ); @@ -151,7 +151,7 @@ public class ConfigOptionValueWidget { access.closeMenu(); access.focusKeycode((CompositeOption<ModifierKeyCode>) option); }); - BiConsumer<PoseStack, Label> render = label.getOnRender(); + BiConsumer<GuiGraphics, Label> render = label.getOnRender(); label.onRender((poses, $) -> { render.accept(poses, $); setText.accept(((ModifierKeyCode) access.get(option)).getLocalizedName()); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionWidget.java index ec6ee275c..e695d79b0 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionWidget.java @@ -23,7 +23,6 @@ package me.shedaniel.rei.impl.client.gui.config.components; -import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.clothconfig2.api.ScissorsHandler; import me.shedaniel.clothconfig2.api.animator.NumberAnimator; import me.shedaniel.clothconfig2.api.animator.ValueAnimator; @@ -40,6 +39,7 @@ import me.shedaniel.rei.impl.client.gui.config.options.ConfigUtils; import me.shedaniel.rei.impl.client.gui.text.TextTransformations; import net.minecraft.Util; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.network.chat.MutableComponent; import net.minecraft.util.FormattedCharSequence; @@ -106,13 +106,13 @@ public class ConfigOptionWidget { } @Override - public void render(PoseStack poses, int mouseX, int mouseY, float delta) { + public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { this.previewHeight.update(delta); if (ConfigUtils.isReducedMotion()) this.previewHeight.completeImmediately(); height[0] = stableHeight[0] + Math.round(this.previewHeight.value()); for (int i = 0; i < split.size(); i++) { - Minecraft.getInstance().font.draw(poses, split.get(i), 0, 12 + 12 * i, -1); + graphics.drawString(Minecraft.getInstance().font, split.get(i), 0, 12 + 12 * i, -1, false); } if (hasPreview) { @@ -122,12 +122,12 @@ public class ConfigOptionWidget { this.previewLabel.setPoint(new Point(width, 12 + 12 * split.size() - 12)); } - this.previewLabel.render(poses, mouseX, mouseY, delta); + this.previewLabel.render(graphics, mouseX, mouseY, delta); if (this.preview != null && this.previewHeight.value() > 0.1f) { - ScissorsHandler.INSTANCE.scissor(MatrixUtils.transform(poses.last().pose(), new Rectangle(0, 24 + 12 * split.size() - (nextLinePreview ? 0 : 12), width, this.previewHeight.value()))); + ScissorsHandler.INSTANCE.scissor(MatrixUtils.transform(graphics.pose().last().pose(), new Rectangle(0, 24 + 12 * split.size() - (nextLinePreview ? 0 : 12), width, this.previewHeight.value()))); this.previewTranslation = new Matrix4f().translate(0, 12 + 12 * split.size(), 100); - this.preview.render(poses, mouseX, mouseY, delta); + this.preview.render(graphics, mouseX, mouseY, delta); ScissorsHandler.INSTANCE.removeLastScissor(); } } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigSearchWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigSearchWidget.java index d68ff3933..f910d88e0 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigSearchWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigSearchWidget.java @@ -23,7 +23,6 @@ package me.shedaniel.rei.impl.client.gui.config.components; -import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.gui.widgets.Label; @@ -36,6 +35,7 @@ import me.shedaniel.rei.impl.client.gui.config.options.OptionCategory; import me.shedaniel.rei.impl.client.gui.config.options.OptionGroup; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.resources.ResourceLocation; @@ -56,14 +56,14 @@ public class ConfigSearchWidget { bounds, new Widget() { @Override - public void render(PoseStack poses, int mouseX, int mouseY, float delta) { + public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { boolean hovering = new Rectangle(-1, -1, width.getAsInt() + 2, 21).contains(mouseX, mouseY); for (Widget widget : List.of(Widgets.createFilledRectangle(new Rectangle(1, 1, width.getAsInt() - 2, 18), hovering ? 0x50FFFFFF : 0x25FFFFFF), Widgets.createFilledRectangle(new Rectangle(-1, -1, width.getAsInt() + 2, 1), hovering ? 0x90FFFFFF : 0x45FFFFFF), Widgets.createFilledRectangle(new Rectangle(-1, 20, width.getAsInt() + 2, 1), hovering ? 0x90FFFFFF : 0x45FFFFFF), Widgets.createFilledRectangle(new Rectangle(-1, 0, 1, 20), hovering ? 0x90FFFFFF : 0x45FFFFFF), Widgets.createFilledRectangle(new Rectangle(width.getAsInt(), 0, 1, 20), hovering ? 0x90FFFFFF : 0x45FFFFFF))) { - widget.render(poses, mouseX, mouseY, delta); + widget.render(graphics, mouseX, mouseY, delta); } label.setColor(hovering ? 0xFFE1E1E1 : 0xFFC0C0C0); } @@ -96,18 +96,18 @@ public class ConfigSearchWidget { bounds, new Widget() { @Override - public void render(PoseStack poses, int mouseX, int mouseY, float delta) { + public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { boolean hovering = new Rectangle(-1, -1, 18, 18).contains(mouseX, mouseY); - poses.pushPose(); - poses.translate(-0.5, -0.5, 0); + graphics.pose().pushPose(); + graphics.pose().translate(-0.5, -0.5, 0); for (Widget widget : List.of(Widgets.createFilledRectangle(new Rectangle(-1, -1, 18, 18), hovering ? 0x50FFFFFF : 0x25FFFFFF), Widgets.createFilledRectangle(new Rectangle(-3, -3, 22, 1), hovering ? 0x90FFFFFF : 0x45FFFFFF), Widgets.createFilledRectangle(new Rectangle(-3, 18, 22, 1), hovering ? 0x90FFFFFF : 0x45FFFFFF), Widgets.createFilledRectangle(new Rectangle(-3, -2, 1, 20), hovering ? 0x90FFFFFF : 0x45FFFFFF), Widgets.createFilledRectangle(new Rectangle(18, -2, 1, 20), hovering ? 0x90FFFFFF : 0x45FFFFFF))) { - widget.render(poses, mouseX, mouseY, delta); + widget.render(graphics, mouseX, mouseY, delta); } - poses.popPose(); + graphics.pose().popPose(); } @Override diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/configure/PanelBoundariesConfiguration.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/configure/PanelBoundariesConfiguration.java index b8e3e619e..0530ba503 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/configure/PanelBoundariesConfiguration.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/configure/PanelBoundariesConfiguration.java @@ -23,7 +23,6 @@ package me.shedaniel.rei.impl.client.gui.config.options.configure; -import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.clothconfig2.api.animator.NumberAnimator; import me.shedaniel.clothconfig2.api.animator.ValueAnimator; import me.shedaniel.math.FloatingRectangle; @@ -38,6 +37,7 @@ import me.shedaniel.rei.impl.client.gui.config.options.OptionValueEntry; import net.minecraft.ChatFormatting; import net.minecraft.Util; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractSliderButton; import net.minecraft.client.gui.components.Checkbox; import net.minecraft.client.gui.screens.Screen; @@ -268,19 +268,19 @@ public enum PanelBoundariesConfiguration implements OptionValueEntry.Configurato } @Override - public void render(PoseStack poses, int mouseX, int mouseY, float delta) { + public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { this.innerAlphaAnimator.setTarget(this.innerAlphaAnimator.target() + (1.0F - this.innerAlphaAnimator.target()) * 0.06F); this.innerAlphaAnimator.update(delta); - this.renderBackground(poses); + this.renderBackground(graphics); Rectangle panelBounds = new Rectangle(this.width * 3 / 10, this.height * 4 / 40, this.width * 4 / 10, this.height * 32 / 40); - Widgets.createCategoryBase(panelBounds).render(poses, mouseX, mouseY, delta); + Widgets.createCategoryBase(panelBounds).render(graphics, mouseX, mouseY, delta); int y = panelBounds.y + 6; - this.font.draw(poses, translatable("config.rei.options.layout.boundaries.desc.configure").withStyle(ChatFormatting.UNDERLINE), panelBounds.x + 6, y, 0xff404040); + graphics.drawString(this.font, translatable("config.rei.options.layout.boundaries.desc.configure").withStyle(ChatFormatting.UNDERLINE), panelBounds.x + 6, y, 0xff404040, false); y += 14; - this.font.draw(poses, translatable("config.rei.options.layout.boundaries.desc.horizontal"), panelBounds.x + 6, y, 0xff404040); + graphics.drawString(this.font, translatable("config.rei.options.layout.boundaries.desc.horizontal"), panelBounds.x + 6, y, 0xff404040, false); this.horizontalLimit.setX(panelBounds.x + 6); this.horizontalLimit.setY(y + 10); - this.font.draw(poses, translatable("config.rei.options.layout.boundaries.desc.limit_by_percentage"), horizontalLimit.getX() + 24, horizontalLimit.getY() + 6, 0xff404040); + graphics.drawString(this.font, translatable("config.rei.options.layout.boundaries.desc.limit_by_percentage"), horizontalLimit.getX() + 24, horizontalLimit.getY() + 6, 0xff404040, false); y += 32; this.horizontalSlider.setX(panelBounds.x + 6); this.horizontalSlider.setY(y); @@ -291,10 +291,10 @@ public enum PanelBoundariesConfiguration implements OptionValueEntry.Configurato this.horizontalAlignmentSlider.setWidth(panelBounds.width - 12); y += 28; - this.font.draw(poses, translatable("config.rei.options.layout.boundaries.desc.vertical"), panelBounds.x + 6, y, 0xff404040); + graphics.drawString(this.font, translatable("config.rei.options.layout.boundaries.desc.vertical"), panelBounds.x + 6, y, 0xff404040, false); this.verticalLimit.setX(panelBounds.x + 6); this.verticalLimit.setY(y + 10); - this.font.draw(poses, translatable("config.rei.options.layout.boundaries.desc.limit_by_percentage"), verticalLimit.getX() + 24, verticalLimit.getY() + 6, 0xff404040); + graphics.drawString(this.font, translatable("config.rei.options.layout.boundaries.desc.limit_by_percentage"), verticalLimit.getX() + 24, verticalLimit.getY() + 6, 0xff404040, false); y += 32; this.verticalSlider.setX(panelBounds.x + 6); this.verticalSlider.setY(y); @@ -304,11 +304,11 @@ public enum PanelBoundariesConfiguration implements OptionValueEntry.Configurato this.verticalAlignmentSlider.setY(y); |
