From e190cd1e8b2f5d0f29ab9a001853ff981bd2d251 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Tue, 16 Apr 2024 01:01:48 +0900 Subject: Fix merge conflicts --- .../filler/BannerDuplicateRecipeFiller.java | 4 +- .../filler/ShieldDecorationRecipeFiller.java | 6 +-- .../config/entries/ConfigureCategoriesScreen.java | 22 +++++---- .../impl/client/gui/config/REIConfigScreen.java | 2 +- .../components/ConfigCategoryEntryWidget.java | 4 +- .../gui/config/components/ConfigGroupWidget.java | 10 ++-- .../config/components/ConfigOptionValueWidget.java | 2 +- .../gui/config/components/ConfigOptionWidget.java | 6 +-- .../configure/PanelBoundariesConfiguration.java | 28 +++++------ .../config/options/preview/InterfacePreviewer.java | 4 +- .../config/options/preview/TooltipPreviewer.java | 4 +- .../collapsible/CollapsibleEntriesScreen.java | 15 +++--- .../screen/collapsible/CollapsibleEntryWidget.java | 30 ++++++------ .../CustomCollapsibleEntrySelectionScreen.java | 54 +++++++++++----------- .../rei/impl/client/gui/widget/HoleWidget.java | 5 +- .../rei/impl/client/gui/widget/ListWidget.java | 4 +- .../client/gui/widget/ScrollableViewWidget.java | 4 +- .../rei/impl/client/gui/widget/VStackWidget.java | 4 +- .../client/runtime/DefaultClientRuntimePlugin.java | 6 +-- 19 files changed, 106 insertions(+), 108 deletions(-) diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/BannerDuplicateRecipeFiller.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/BannerDuplicateRecipeFiller.java index 72003af8d..127355293 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/BannerDuplicateRecipeFiller.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/BannerDuplicateRecipeFiller.java @@ -29,7 +29,7 @@ import me.shedaniel.rei.api.common.entry.EntryIngredient; import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.util.EntryStacks; import me.shedaniel.rei.plugin.common.displays.crafting.DefaultCustomShapelessDisplay; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Item; @@ -45,7 +45,7 @@ public class BannerDuplicateRecipeFiller implements CraftingRecipeFiller>> displayMap = new HashMap<>(); for (Pair pair : ShieldDecorationRecipeFiller.randomizeBanners()) { - Optional bannerOptional = Registry.ITEM.getOptional(new ResourceLocation(pair.getFirst().getName() + "_banner")); + Optional bannerOptional = BuiltInRegistries.ITEM.getOptional(new ResourceLocation(pair.getFirst().getName() + "_banner")); if (bannerOptional.isEmpty()) continue; Pair> builderPair = displayMap.computeIfAbsent(pair.getFirst(), color -> Pair.of(EntryIngredient.builder(), EntryStacks.of(bannerOptional.get()))); builderPair.getFirst().add(EntryStacks.of(pair.getSecond())); diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ShieldDecorationRecipeFiller.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ShieldDecorationRecipeFiller.java index 24cd5644b..38de05515 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ShieldDecorationRecipeFiller.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ShieldDecorationRecipeFiller.java @@ -32,7 +32,7 @@ import me.shedaniel.rei.api.common.util.EntryIngredients; import me.shedaniel.rei.api.common.util.EntryStacks; import me.shedaniel.rei.plugin.common.displays.crafting.DefaultCustomShapelessDisplay; import net.minecraft.core.Holder; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.*; @@ -49,13 +49,13 @@ public class ShieldDecorationRecipeFiller implements CraftingRecipeFiller bannerOptional = Registry.ITEM.getOptional(new ResourceLocation(color.getName() + "_banner")); + Optional bannerOptional = BuiltInRegistries.ITEM.getOptional(new ResourceLocation(color.getName() + "_banner")); if (bannerOptional.isEmpty()) continue; out.add(Pair.of(color, new ItemStack(bannerOptional.get()))); for (int i = 0; i < 2; i++) { BannerPattern.Builder patternBuilder = new BannerPattern.Builder(); - Holder[] allPatterns = Registry.BANNER_PATTERN.holders().toArray(Holder[]::new); + Holder[] allPatterns = BuiltInRegistries.BANNER_PATTERN.holders().toArray(Holder[]::new); for (int j = 0; j < 2; j++) { Holder pattern = allPatterns[random.nextInt(allPatterns.length - 1) + 1]; patternBuilder.addPattern(pattern, colors[random.nextInt(colors.length)]); 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 4270ffac5..fa612bcd4 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 @@ -52,7 +52,8 @@ public class ConfigureCategoriesScreen extends Screen { private final Set> hiddenCategories; private final List> categoryOrdering; private ListWidget listWidget; - public Runnable editedSink = () -> {}; + public Runnable editedSink = () -> { + }; public Screen parent; public ConfigureCategoriesScreen(Map, Boolean> filteringQuickCraftCategories, Set> hiddenCategories, List> categoryOrdering) { @@ -87,7 +88,8 @@ public class ConfigureCategoriesScreen extends Screen { addRenderableWidget(new Button(4, 4, Minecraft.getInstance().font.width(backText) + 10, 20, backText, button -> { minecraft.setScreen(parent); this.parent = null; - }, Supplier::get) {}); + }, Supplier::get) { + }); } listWidget = addWidget(new ListWidget(minecraft, width, height, 30, height, BACKGROUND_LOCATION)); this.resetListEntries(); @@ -190,7 +192,7 @@ public class ConfigureCategoriesScreen extends Screen { // set to true hiddenCategories.remove(configuration.getCategoryIdentifier()); } - + editedSink.run(); }).leftAligned(); quickCraftToggleButton = Widgets.createClickableLabel(new Point(), toggleText, $ -> { @@ -224,7 +226,8 @@ public class ConfigureCategoriesScreen extends Screen { editedSink.run(); resetListEntries(); } - }, Supplier::get); + }, Supplier::get) { + }; this.downButton = new Button(0, 0, 20, 20, Component.literal("↓"), button -> { int index = categoryOrdering.indexOf(configuration.getCategoryIdentifier()); if (index < categoryOrdering.size() - 1) { @@ -233,7 +236,8 @@ public class ConfigureCategoriesScreen extends Screen { editedSink.run(); resetListEntries(); } - }, Supplier::get); + }, Supplier::get) { + }; this.upButton.active = categoryOrdering.indexOf(configuration.getCategoryIdentifier()) > 0; this.downButton.active = categoryOrdering.indexOf(configuration.getCategoryIdentifier()) < categoryOrdering.size() - 1; } @@ -289,11 +293,11 @@ public class ConfigureCategoriesScreen extends Screen { } else { quickCraftToggleButton.getPoint().setLocation(-12390, -12390); } - upButton.x = x + entryWidth - 20; - upButton.y = y + entryHeight / 2 - 21; + upButton.setX(x + entryWidth - 20); + upButton.setY(y + entryHeight / 2 - 21); upButton.render(matrices, mouseX, mouseY, delta); - downButton.x = x + entryWidth - 20; - downButton.y = y + entryHeight / 2 + 1; + downButton.setX(x + entryWidth - 20); + downButton.setY(y + entryHeight / 2 + 1); downButton.render(matrices, 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 7073df818..6ce0d98c8 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 @@ -225,7 +225,7 @@ public class REIConfigScreen extends Screen implements ConfigAccess { @Override public void render(PoseStack poses, int mouseX, int mouseY, float delta) { - this.renderDirtBackground(0); + this.renderDirtBackground(poses); super.render(poses, mouseX, mouseY, delta); for (Widget widget : widgets) { widget.render(poses, mouseX, mouseY, delta); 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 051464ff0..e682dbe23 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 @@ -24,7 +24,6 @@ package me.shedaniel.rei.impl.client.gui.config.components; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Matrix4f; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.gui.widgets.*; @@ -37,6 +36,7 @@ import net.minecraft.client.gui.Font; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.util.FormattedCharSequence; +import org.joml.Matrix4f; import static me.shedaniel.rei.api.client.gui.widgets.Widget.scissor; @@ -54,7 +54,7 @@ public class ConfigCategoryEntryWidget { return Widgets.concatWithBounds( bounds, label, - hasDescription ? Widgets.withTranslate(Widgets.withTranslate(descriptionLabel, Matrix4f.createScaleMatrix(0.75f, 0.75f, 0.75f)), 21, 5 + 10, 0) : Widgets.noOp(), + hasDescription ? Widgets.withTranslate(Widgets.withTranslate(descriptionLabel, new Matrix4f().scale(0.75f, 0.75f, 0.75f)), 21, 5 + 10, 0) : Widgets.noOp(), Widgets.createTexturedWidget(category.getIcon(), new Rectangle(3, hasDescription ? 5 : 3, 16, 16), 0, 0, 1, 1, 1, 1) ); } 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 59546ec9e..161a38f69 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 @@ -23,7 +23,6 @@ package me.shedaniel.rei.impl.client.gui.config.components; -import com.mojang.math.Matrix4f; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.gui.widgets.Widget; @@ -41,6 +40,7 @@ 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; import java.util.*; import java.util.function.IntConsumer; @@ -84,11 +84,11 @@ public class ConfigGroupWidget { Widget background = createBackgroundSlot(widget::getBounds); if (location == PreviewLocation.TOP) { - WidgetWithBounds translatedOriginal = Widgets.withTranslate(original, () -> Matrix4f.createTranslateMatrix(0, widget.getBounds().height + 4, 0)); + WidgetWithBounds translatedOriginal = Widgets.withTranslate(original, () -> new Matrix4f().translate(0, widget.getBounds().height + 4, 0)); contents = Widgets.concatWithBounds(() -> new Rectangle(0, 0, width, widget.getBounds().height + 4 + translatedOriginal.getBounds().height), translatedOriginal, background, widget); } else { contents = Widgets.concatWithBounds(() -> new Rectangle(0, 0, width, original.getBounds().getMaxY() + 2 + widget.getBounds().height), original, - Widgets.withTranslate(Widgets.concat(background, widget), () -> Matrix4f.createTranslateMatrix(0, original.getBounds().getMaxY() + 4, 0))); + Widgets.withTranslate(Widgets.concat(background, widget), () -> new Matrix4f().translate(0, original.getBounds().getMaxY() + 4, 0))); } } } else { @@ -98,7 +98,7 @@ public class ConfigGroupWidget { return Widgets.concatWithBounds( () -> new Rectangle(0, 0, width, groupTitle.getBounds().getMaxY() + contents.getBounds().height), groupTitle, - Widgets.withTranslate(contents, () -> Matrix4f.createTranslateMatrix(0, groupTitle.getBounds().getMaxY(), 0)) + Widgets.withTranslate(contents, () -> new Matrix4f().translate(0, groupTitle.getBounds().getMaxY(), 0)) ); } @@ -156,7 +156,7 @@ public class ConfigGroupWidget { private static void recalculateHeight(List widgets, IntConsumer setHeight) { int height = 0; for (WidgetComposite widget : widgets) { - widget.translation().load(Matrix4f.createTranslateMatrix(0, height, 0)); + widget.translation().set(new Matrix4f().translate(0, height, 0)); height = Math.max(height, widget.bounds().get().getMaxY()); } setHeight.accept(height); 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 015804d65..7d605ccbe 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 @@ -24,7 +24,6 @@ package me.shedaniel.rei.impl.client.gui.config.components; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Matrix4f; import me.shedaniel.clothconfig2.api.ModifierKeyCode; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; @@ -47,6 +46,7 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; import net.minecraft.resources.ResourceLocation; +import org.joml.Matrix4f; import java.util.Objects; import java.util.function.BiConsumer; 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 f2a47a332..ec6ee275c 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 @@ -24,7 +24,6 @@ package me.shedaniel.rei.impl.client.gui.config.components; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Matrix4f; import me.shedaniel.clothconfig2.api.ScissorsHandler; import me.shedaniel.clothconfig2.api.animator.NumberAnimator; import me.shedaniel.clothconfig2.api.animator.ValueAnimator; @@ -45,6 +44,7 @@ import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.network.chat.MutableComponent; import net.minecraft.util.FormattedCharSequence; import org.jetbrains.annotations.Nullable; +import org.joml.Matrix4f; import java.util.ArrayList; import java.util.List; @@ -61,7 +61,7 @@ public class ConfigOptionWidget { widgets.add(fieldNameLabel = Widgets.createLabel(new Point(0, 0), TextTransformations.highlightText(option.getName().copy(), option.getOptionNameHighlight(), style -> style.withColor(0xFFC0C0C0))) .leftAligned()); WidgetWithBounds optionValue = ConfigOptionValueWidget.create(access, option, width - 10 - fieldNameLabel.getBounds().width); - widgets.add(Widgets.withTranslate(optionValue, () -> Matrix4f.createTranslateMatrix(width - optionValue.getBounds().width - optionValue.getBounds().x, 0, 0))); + widgets.add(Widgets.withTranslate(optionValue, () -> new Matrix4f().translate(width - optionValue.getBounds().width - optionValue.getBounds().x, 0, 0))); widgets.add(new WidgetWithBounds() { final MutableComponent description = Util.make(() -> { MutableComponent description = option.getDescription().copy(); @@ -126,7 +126,7 @@ public class ConfigOptionWidget { 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()))); - this.previewTranslation = Matrix4f.createTranslateMatrix(0, 12 + 12 * split.size(), 100); + this.previewTranslation = new Matrix4f().translate(0, 12 + 12 * split.size(), 100); this.preview.render(poses, mouseX, mouseY, delta); ScissorsHandler.INSTANCE.removeLastScissor(); } 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 0322a25ae..b8e3e619e 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 @@ -278,30 +278,30 @@ public enum PanelBoundariesConfiguration implements OptionValueEntry.Configurato this.font.draw(poses, translatable("config.rei.options.layout.boundaries.desc.configure").withStyle(ChatFormatting.UNDERLINE), panelBounds.x + 6, y, 0xff404040); y += 14; this.font.draw(poses, translatable("config.rei.options.layout.boundaries.desc.horizontal"), panelBounds.x + 6, y, 0xff404040); - this.horizontalLimit.x = panelBounds.x + 6; - this.horizontalLimit.y = y + 10; - this.font.draw(poses, translatable("config.rei.options.layout.boundaries.desc.limit_by_percentage"), horizontalLimit.x + 24, horizontalLimit.y + 6, 0xff404040); + 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); y += 32; - this.horizontalSlider.x = panelBounds.x + 6; - this.horizontalSlider.y = y; + this.horizontalSlider.setX(panelBounds.x + 6); + this.horizontalSlider.setY(y); this.horizontalSlider.setWidth(panelBounds.width - 12); y += 22; - this.horizontalAlignmentSlider.x = panelBounds.x + 6; - this.horizontalAlignmentSlider.y = y; + this.horizontalAlignmentSlider.setX(panelBounds.x + 6); + this.horizontalAlignmentSlider.setY(y); 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); - this.verticalLimit.x = panelBounds.x + 6; - this.verticalLimit.y = y + 10; - this.font.draw(poses, translatable("config.rei.options.layout.boundaries.desc.limit_by_percentage"), verticalLimit.x + 24, verticalLimit.y + 6, 0xff404040); + 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); y += 32; - this.verticalSlider.x = panelBounds.x + 6; - this.verticalSlider.y = y; + this.verticalSlider.setX(panelBounds.x + 6); + this.verticalSlider.setY(y); this.verticalSlider.setWidth(panelBounds.width - 12); y += 22; - this.verticalAlignmentSlider.x = panelBounds.x + 6; - this.verticalAlignmentSlider.y = y; + this.verticalAlignmentSlider.setX(panelBounds.x + 6); + this.verticalAlignmentSlider.setY(y); this.verticalAlignmentSlider.setWidth(panelBounds.width - 12); super.render(poses, mouseX, mouseY, delta); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/InterfacePreviewer.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/InterfacePreviewer.java index 80e493784..85a5fc640 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/InterfacePreviewer.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/InterfacePreviewer.java @@ -23,7 +23,6 @@ package me.shedaniel.rei.impl.client.gui.config.options.preview; -import com.mojang.math.Matrix4f; import me.shedaniel.clothconfig2.api.animator.NumberAnimator; import me.shedaniel.clothconfig2.api.animator.ValueAnimator; import me.shedaniel.math.Point; @@ -44,6 +43,7 @@ import me.shedaniel.rei.impl.client.gui.widget.basewidgets.PanelWidget; import net.minecraft.Util; import net.minecraft.world.item.Items; import org.jetbrains.annotations.Nullable; +import org.joml.Matrix4f; import java.util.ArrayList; import java.util.List; @@ -65,7 +65,7 @@ public class InterfacePreviewer { base.getBounds().setBounds(2, 2, width - 4, height.getAsInt() - 4); return base; }), - Widgets.withTranslate(widget, () -> Matrix4f.createTranslateMatrix(0, (height.getAsInt() - widget.getBounds().height) / 2, 0)) + Widgets.withTranslate(widget, () -> new Matrix4f().translate(0, (height.getAsInt() - widget.getBounds().height) / 2, 0)) ); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/TooltipPreviewer.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/TooltipPreviewer.java index ad5e74d27..bc1922412 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/TooltipPreviewer.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/TooltipPreviewer.java @@ -25,7 +25,6 @@ package me.shedaniel.rei.impl.client.gui.config.options.preview; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.*; -import com.mojang.math.Matrix4f; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.config.ConfigObject; import me.shedaniel.rei.api.client.gui.widgets.Tooltip; @@ -43,6 +42,7 @@ import net.minecraft.client.resources.language.I18n; import net.minecraft.util.FormattedCharSequence; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import org.joml.Matrix4f; import javax.annotation.Nullable; import java.util.ArrayList; @@ -93,12 +93,10 @@ public class TooltipPreviewer { fillGradient(matrix4f, bufferBuilder, tX - 3, tY - 3, tX + tWidth + 3, tY - 3 + 1, 400, 1347420415, 1347420415); fillGradient(matrix4f, bufferBuilder, tX - 3, tY + tHeight + 2, tX + tWidth + 3, tY + tHeight + 3, 400, 1344798847, 1344798847); RenderSystem.enableDepthTest(); - RenderSystem.disableTexture(); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); BufferUploader.drawWithShader(bufferBuilder.end()); RenderSystem.disableBlend(); - RenderSystem.enableTexture(); matrices.translate(0, 0, 400); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/CollapsibleEntriesScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/CollapsibleEntriesScreen.java index 2d3e782b1..6c088cadf 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/CollapsibleEntriesScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/CollapsibleEntriesScreen.java @@ -27,7 +27,6 @@ import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.*; -import com.mojang.math.Matrix4f; import me.shedaniel.clothconfig2.ClothConfigInitializer; import me.shedaniel.clothconfig2.api.scroll.ScrollingContainer; import me.shedaniel.math.Rectangle; @@ -49,6 +48,7 @@ import me.shedaniel.rei.impl.common.entry.type.collapsed.CollapsibleEntryRegistr import me.shedaniel.rei.impl.common.util.HashedEntryStackWrapper; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiComponent; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.events.GuiEventListener; @@ -57,9 +57,11 @@ import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import org.joml.Matrix4f; import java.util.*; import java.util.function.Consumer; +import java.util.function.Supplier; public class CollapsibleEntriesScreen extends Screen { private final Runnable onClose; @@ -112,7 +114,8 @@ public class CollapsibleEntriesScreen extends Screen { { Component backText = Component.literal("↩ ").append(Component.translatable("gui.back")); addRenderableWidget(new Button(4, 4, font.width(backText) + 10, 20, backText, - button -> this.onClose())); + button -> this.onClose(), Supplier::get) { + }); } { Component addText = Component.literal(" + "); @@ -121,7 +124,8 @@ public class CollapsibleEntriesScreen extends Screen { this.prepareWidgets(configObject); this.dirty = true; }); - })); + }, Supplier::get) { + }); } this.listWidget = new ListWidget(width, height, 30); @@ -185,9 +189,8 @@ public class CollapsibleEntriesScreen extends Screen { fillGradient(poses, minecraft.screen.width - stringWidth - 2, 32, minecraft.screen.width, 32 + font.lineHeight + 2, -16777216, -16777216); MultiBufferSource.BufferSource immediate = MultiBufferSource.immediate(Tesselator.getInstance().getBuilder()); poses.pushPose(); - poses.translate(0.0D, 0.0D, getBlitOffset()); Matrix4f matrix = poses.last().pose(); - font.drawInBatch(debugText.getVisualOrderText(), minecraft.screen.width - stringWidth, 32 + 2, -1, false, matrix, immediate, false, 0, 15728880); + font.drawInBatch(debugText.getVisualOrderText(), minecraft.screen.width - stringWidth, 32 + 2, -1, false, matrix, immediate, Font.DisplayMode.NORMAL, 0, 15728880); immediate.endBatch(); poses.popPose(); } @@ -252,7 +255,6 @@ public class CollapsibleEntriesScreen extends Screen { GuiComponent.BACKGROUND_LOCATION, 0, this.top, this.width, this.height, 0, 32); RenderSystem.enableBlend(); RenderSystem.blendFuncSeparate(770, 771, 0, 1); - RenderSystem.disableTexture(); RenderSystem.setShader(GameRenderer::getPositionTexColorShader); Matrix4f matrix = poses.last().pose(); buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); @@ -261,7 +263,6 @@ public class CollapsibleEntriesScreen extends Screen { buffer.vertex(matrix, this.width, this.top, 0.0F).uv(1, 0).color(0xFF000000).endVertex(); buffer.vertex(matrix, 0, this.top, 0.0F).uv(0, 0).color(0xFF000000).endVertex(); tesselator.end(); - RenderSystem.enableTexture(); RenderSystem.disableBlend(); try (CloseableScissors scissors = scissor(poses, new Rectangle(0, this.top, this.width - 6, this.height - this.top))) { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/CollapsibleEntryWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/CollapsibleEntryWidget.java index 8ad908c34..88596a0f7 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/CollapsibleEntryWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/CollapsibleEntryWidget.java @@ -25,7 +25,6 @@ package me.shedaniel.rei.impl.client.gui.screen.collapsible; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.*; -import com.mojang.math.Matrix4f; import me.shedaniel.clothconfig2.ClothConfigInitializer; import me.shedaniel.clothconfig2.api.animator.ProgressValueAnimator; import me.shedaniel.clothconfig2.api.animator.ValueAnimator; @@ -45,7 +44,6 @@ import me.shedaniel.rei.impl.client.gui.ScreenOverlayImpl; import me.shedaniel.rei.impl.client.gui.text.TextTransformations; import me.shedaniel.rei.impl.client.gui.widget.BatchedEntryRendererManager; import me.shedaniel.rei.impl.client.gui.widget.EntryWidget; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.renderer.GameRenderer; @@ -54,10 +52,12 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.util.FormattedCharSequence; import net.minecraft.util.Mth; import org.jetbrains.annotations.Nullable; +import org.joml.Matrix4f; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.function.Supplier; @SuppressWarnings("UnstableApiUsage") public class CollapsibleEntryWidget extends WidgetWithBounds { @@ -104,20 +104,22 @@ public class CollapsibleEntryWidget extends WidgetWithBounds { } else { this.configObject.disabledGroups.add(this.id); } - }); + }, Supplier::get) { + }; this.toggleButton.setWidth(this.font.width(toggleButton.getMessage()) + 8); if (this.custom) { this.deleteButton = new Button(0, 0, 20, 20, Component.translatable("text.rei.collapsible.entries.delete"), button -> { this.configObject.customGroups.removeIf(customEntry -> customEntry.id.equals(this.id)); markDirty.run(); - }); + }, Supplier::get) { + }; this.deleteButton.setWidth(this.font.width(deleteButton.getMessage()) + 8); this.configureButton = new Button(0, 0, 20, 20, Component.nullToEmpty(null), button -> { CollapsibleEntriesScreen.setupCustom(this.id, this.component.getString(), new ArrayList<>(stacks), this.configObject, markDirty); - }) { + }, Supplier::get) { @Override - protected void renderBg(PoseStack matrices, Minecraft client, int mouseX, int mouseY) { - super.renderBg(matrices, client, mouseX, mouseY); + public void render(PoseStack matrices, int mouseX, int mouseY, float delta) { + super.render(matrices, mouseX, mouseY, delta); RenderSystem.setShaderTexture(0, InternalTextures.CHEST_GUI_TEXTURE); blit(matrices, x + 3, y + 3, 0, 0, 14, 14); } @@ -199,21 +201,21 @@ public class CollapsibleEntryWidget extends WidgetWithBounds { poses.pushPose(); poses.translate(0, 0, 400); - this.toggleButton.x = bounds.getMaxX() - 4 - toggleButton.getWidth(); - this.toggleButton.y = bounds.getMaxY() - 4 - toggleButton.getHeight(); + this.toggleButton.setX(bounds.getMaxX() - 4 - toggleButton.getWidth()); + this.toggleButton.setY(bounds.getMaxY() - 4 - toggleButton.getHeight()); this.toggleButton.render(poses, mouseX, mouseY, delta); if (this.toggleButton.isMouseOver(mouseX, mouseY)) { ScreenOverlayImpl.getInstance().clearTooltips(); } if (this.custom) { - this.deleteButton.x = toggleButton.x - 2 - deleteButton.getWidth(); - this.deleteButton.y = bounds.getMaxY() - 4 - deleteButton.getHeight(); + this.deleteButton.setX(toggleButton.getX() - 2 - deleteButton.getWidth()); + this.deleteButton.setY(bounds.getMaxY() - 4 - deleteButton.getHeight()); this.deleteButton.render(poses, mouseX, mouseY, delta); if (this.deleteButton.isMouseOver(mouseX, mouseY)) { ScreenOverlayImpl.getInstance().clearTooltips(); } - this.configureButton.x = deleteButton.x - 2 - configureButton.getWidth(); - this.configureButton.y = bounds.getMaxY() - 4 - configureButton.getHeight(); + this.configureButton.setX(deleteButton.getX() - 2 - configureButton.getWidth()); + this.configureButton.setY(bounds.getMaxY() - 4 - configureButton.getHeight()); this.configureButton.render(poses, mouseX, mouseY, delta); if (this.configureButton.isMouseOver(mouseX, mouseY)) { ScreenOverlayImpl.getInstance().clearTooltips(); @@ -252,7 +254,6 @@ public class CollapsibleEntryWidget extends WidgetWithBounds { if (this.stacks.size() > rowSize * 3) { Tesselator tesselator = Tesselator.getInstance(); BufferBuilder buffer = tesselator.getBuilder(); - RenderSystem.disableTexture(); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); RenderSystem.setShader(GameRenderer::getPositionColorShader); @@ -264,7 +265,6 @@ public class CollapsibleEntryWidget extends WidgetWithBounds { buffer.vertex(matrix, this.x + this.width - 1, this.y + this.height - 40, 0.0F).color(0x00000000).endVertex(); buffer.vertex(matrix, this.x + 1, this.y + this.height - 40, 0.0F).color(0x00000000).endVertex(); tesselator.end(); - RenderSystem.enableTexture(); RenderSystem.disableBlend(); } } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/selection/CustomCollapsibleEntrySelectionScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/selection/CustomCollapsibleEntrySelectionScreen.java index 11a2d12ed..8364e3cca 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/selection/CustomCollapsibleEntrySelectionScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/selection/CustomCollapsibleEntrySelectionScreen.java @@ -27,7 +27,6 @@ import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.*; -import com.mojang.math.Matrix4f; import me.shedaniel.clothconfig2.ClothConfigInitializer; import me.shedaniel.clothconfig2.api.ScissorsHandler; import me.shedaniel.clothconfig2.api.scroll.ScrollingContainer; @@ -56,12 +55,14 @@ import net.minecraft.network.chat.Component; import net.minecraft.util.Mth; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; +import org.joml.Matrix4f; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; import java.util.function.Predicate; +import java.util.function.Supplier; import static me.shedaniel.rei.impl.client.gui.widget.entrylist.EntryListWidget.entrySize; @@ -93,7 +94,8 @@ public class CustomCollapsibleEntrySelectionScreen extends Screen { private List entries = Collections.emptyList(); private List elements = Collections.emptyList(); - private record PointPair(Point firstPoint, @Nullable Point secondPoint) {} + private record PointPair(Point firstPoint, @Nullable Point secondPoint) { + } private final List points = new ArrayList<>(); @@ -116,13 +118,15 @@ public class CustomCollapsibleEntrySelectionScreen extends Screen { this.selectAllButton = new Button(0, 0, Minecraft.getInstance().font.width(selectAllText) + 10, 20, selectAllText, button -> { this.points.clear(); this.points.add(new PointPair(new Point(-Integer.MAX_VALUE / 2, -Integer.MAX_VALUE / 2), new Point(Integer.MAX_VALUE / 2, Integer.MAX_VALUE / 2))); - }); + }, Supplier::get) { + }; } { Component selectNoneText = Component.translatable("config.roughlyenoughitems.filteredEntries.selectNone"); this.selectNoneButton = new Button(0, 0, Minecraft.getInstance().font.width(selectNoneText) + 10, 20, selectNoneText, button -> { this.points.clear(); - }); + }, Supplier::get) { + }; } { Component addText = Component.translatable("text.rei.collapsible.entries.custom.select.add"); @@ -136,7 +140,8 @@ public class CustomCollapsibleEntrySelectionScreen extends Screen { entry.dirty = true; } } - }); + }, Supplier::get) { + }; } { Component removeText = Component.translatable("text.rei.collapsible.entries.custom.select.remove"); @@ -149,14 +154,16 @@ public class CustomCollapsibleEntrySelectionScreen extends Screen { entry.dirty = true; } } - }); + }, Supplier::get) { + }; } { Component backText = Component.literal("↩ ").append(Component.translatable("gui.back")); this.backButton = new Button(0, 0, Minecraft.getInstance().font.width(backText) + 10, 20, backText, button -> { minecraft.setScreen(parent); this.parent = null; - }); + }, Supplier::get) { + }; } this.searchField.isMain = false; } @@ -181,18 +188,18 @@ public class CustomCollapsibleEntrySelectionScreen extends Screen { super.init(); Rectangle bounds = getBounds(); updateSearch(this.searchField.getText()); - this.selectAllButton.x = 2; - this.selectAllButton.y = bounds.getMaxY() - 22; - this.selectNoneButton.x = 4 + selectAllButton.getWidth(); - this.selectNoneButton.y = bounds.getMaxY() - 22; - int searchFieldWidth = Math.max(bounds.width - (selectNoneButton.x + selectNoneButton.getWidth() + addButton.getWidth() + removeButton.getWidth() + 12), 100); - this.searchField.getBounds().setBounds(selectNoneButton.x + selectNoneButton.getWidth() + 4, bounds.getMaxY() - 21, searchFieldWidth, 18); - this.addButton.x = bounds.getMaxX() - addButton.getWidth() - removeButton.getWidth() - 4; - this.addButton.y = bounds.getMaxY() - 22; - this.removeButton.x = bounds.getMaxX() - removeButton.getWidth() - 2; - this.removeButton.y = bounds.getMaxY() - 22; - this.backButton.x = 4; - this.backButton.y = 4; + this.selectAllButton.setX(2); + this.selectAllButton.setY(bounds.getMaxY() - 22); + this.selectNoneButton.setX(4 + selectAllButton.getWidth()); + this.selectNoneButton.setY(bounds.getMaxY() - 22); + int searchFieldWidth = Math.max(bounds.width - (selectNoneButton.getX() + selectNoneButton.getWidth() + addButton.getWidth() + removeButton.getWidth() + 12), 100); + this.searchField.getBounds().setBounds(selectNoneButton.getX() + selectNoneButton.getWidth() + 4, bounds.getMaxY() - 21, searchFieldWidth, 18); + this.addButton.setX(bounds.getMaxX() - addButton.getWidth() - removeButton.getWidth() - 4); + this.addButton.setY(bounds.getMaxY() - 22); + this.removeButton.setX(bounds.getMaxX() - removeButton.getWidth() - 2); + this.removeButton.setY(bounds.getMaxY() - 22); + this.backButton.setX(4); + this.backButton.setY(4); this.searchField.setResponder(this::updateSearch); } @@ -254,7 +261,6 @@ public class CustomCollapsibleEntrySelectionScreen extends Screen { BufferBuilder buffer = tesselator.getBuilder(); RenderSystem.enableBlend(); RenderSystem.blendFuncSeparate(770, 771, 0, 1); - RenderSystem.disableTexture(); RenderSystem.setShader(GameRenderer::getPositionTexColorShader); Matrix4f matrix = poses.last().pose(); buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); @@ -263,7 +269,6 @@ public class CustomCollapsibleEntrySelectionScreen extends Screen { buffer.vertex(matrix, width, bounds.y, 0.0F).uv(1.0F, 0.0F).color(0, 0, 0, 255).endVertex(); buffer.vertex(matrix, 0, bounds.y, 0.0F).uv(0.0F, 0.0F).color(0, 0, 0, 255).endVertex(); tesselator.end(); - RenderSystem.enableTexture(); RenderSystem.disableBlend(); renderHoleBackground(poses, 0, bounds.y, 64, 255, 255); @@ -431,13 +436,6 @@ public class CustomCollapsibleEntrySelectionScreen extends Screen { if (keyCode == 256 && this.shouldCloseOnEsc()) { this.backButton.onPress(); - return true; - } else if (keyCode == 258) { - boolean bl = !hasShiftDown(); - if (!this.changeFocus(bl)) { - this.changeFocus(bl); - } - return true; } return false; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/HoleWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/HoleWidget.java index 8e3440e39..e0f376615 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/HoleWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/HoleWidget.java @@ -28,14 +28,13 @@ import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.Tesselator; import com.mojang.blaze3d.vertex.VertexFormat; -import com.mojang.math.Matrix4f; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.api.client.gui.widgets.Widgets; -import me.shedaniel.rei.impl.client.gui.widget.DynamicErrorFreeEntryListWidget; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.resources.ResourceLocation; +import org.joml.Matrix4f; import java.util.function.IntSupplier; @@ -81,7 +80,6 @@ public class HoleWidget { RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.enableBlend(); RenderSystem.blendFuncSeparate(770, 771, 0, 1); - RenderSystem.disableTexture(); RenderSystem.setShader(GameRenderer::getPositionTexColorShader); Matrix4f matrix = matrices.last().pose(); buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); @@ -94,7 +92,6 @@ public class HoleWidget { buffer.vertex(matrix, bounds.getMaxX(), bounds.getMaxY() - 4, 0.0F).uv(1, 0).color(0, 0, 0, 0).endVertex(); buffer.vertex(matrix, bounds.x, bounds.getMaxY() - 4, 0.0F).uv(0, 0).color(0, 0, 0, 0).endVertex(); tesselator.end(); - RenderSystem.enableTexture(); RenderSystem.disableBlend(); }), bounds); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/ListWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/ListWidget.java index c7beda3ed..701d25a0f 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/ListWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/ListWidget.java @@ -23,7 +23,6 @@ package me.shedaniel.rei.impl.client.gui.widget; -import com.mojang.math.Matrix4f; import dev.architectury.utils.value.IntValue; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; @@ -32,6 +31,7 @@ import me.shedaniel.rei.api.client.gui.widgets.WidgetWithBounds; import me.shedaniel.rei.api.client.gui.widgets.Widgets; import me.shedaniel.rei.api.common.util.CollectionUtils; import net.minecraft.client.gui.GuiComponent; +import org.joml.Matrix4f; import java.util.ArrayList; import java.util.List; @@ -227,7 +227,7 @@ public class ListWidget { @Override protected Matrix4f translate() { Rectangle bounds = delegate().getBounds(); - return Matrix4f.createTranslateMatrix(position.x - bounds.x, position.y - bounds.y, 0); + return new Matrix4f().translate(position.x - bounds.x, position.y - bounds.y, 0); } } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/ScrollableViewWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/ScrollableViewWidget.java index 40ea375ab..faaa460c7 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/ScrollableViewWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/ScrollableViewWidget.java @@ -24,7 +24,6 @@ package me.shedaniel.rei.impl.client.gui.widget; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Matrix4f; import me.shedaniel.clothconfig2.ClothConfigInitializer; import me.shedaniel.clothconfig2.api.scroll.ScrollingContainer; import me.shedaniel.math.Rectangle; @@ -32,6 +31,7 @@ import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.api.client.gui.widgets.WidgetWithBounds; import me.shedaniel.rei.api.client.gui.widgets.Widgets; import net.minecraft.client.gui.components.events.GuiEventListener; +import org.joml.Matrix4f; import java.util.ArrayList; import java.util.Collections; @@ -62,7 +62,7 @@ public class ScrollableViewWidget { } widgets.add(Widgets.scissored(scrollingRef[0].getScissorBounds(), Widgets.withTranslate(inner, - () -> Matrix4f.createTranslateMatrix(0, -scrollingRef[0].scrollAmountInt(), 0)))); + () -> new Matrix4f().translate(0, -scrollingRef[0].scrollAmountInt(), 0)))); widgets.add(Widgets.createDrawableWidget((helper, matrices, mouseX, mouseY, delta) -> { scrollingRef[0].updatePosition(delta); scrollingRef[0].renderScrollBar(); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/VStackWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/VStackWidget.java index d82c2ba3b..9ecf8df4a 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/VStackWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/VStackWidget.java @@ -24,13 +24,13 @@ package me.shedaniel.rei.impl.client.gui.widget; import com.google.common.collect.ForwardingList; -import com.mojang.math.Matrix4f; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.api.client.gui.widgets.WidgetWithBounds; import me.shedaniel.rei.api.client.gui.widgets.Widgets; import me.shedaniel.rei.api.common.util.CollectionUtils; +import org.joml.Matrix4f; import java.util.ArrayList; import java.util.List; @@ -125,7 +125,7 @@ public class VStackWidget { @Override protected Matrix4f translate() { Rectangle bounds = delegate().getBounds(); - return Matrix4f.createTranslateMatrix(position.x - bounds.x, position.y - bounds.y, 0); + return new Matrix4f().translate(position.x - bounds.x, position.y - bounds.y, 0); } } diff --git a/runtime/src/main/java/me/shedaniel/rei/plugin/client/runtime/DefaultClientRuntimePlugin.java b/runtime/src/main/java/me/shedaniel/rei/plugin/client/runtime/DefaultClientRuntimePlugin.java index 9382fd6a7..69628cf7e 100644 --- a/runtime/src/main/java/me/shedaniel/rei/plugin/client/runtime/DefaultClientRuntimePlugin.java +++ b/runtime/src/main/java/me/shedaniel/rei/plugin/client/runtime/DefaultClientRuntimePlugin.java @@ -299,15 +299,15 @@ public class DefaultClientRuntimePlugin implements REIClientPlugin { return DataResult.success(new DisplayFavoriteEntry(null, UUID.fromString(object.getString("UUID"))), Lifecycle.stable()); } } catch (Throwable throwable) { - return DataResult.error(throwable.getMessage()); + return DataResult.error(throwable::getMessage); } } @Override public DataResult fromArgs(Object... args) { - if (args.length == 0) return DataResult.error("Cannot create DisplayFavoriteEntry from empty args!"); + if (args.length == 0) return DataResult.error(() -> "Cannot create DisplayFavoriteEntry from empty args!"); if (!(args[0] instanceof Display display)) - return DataResult.error("Creation of DisplayFavoriteEntry from args expected Display as the first argument!"); + return DataResult.error(() -> "Creation of DisplayFavoriteEntry from args expected Display as the first argument!"); return DataResult.success(new DisplayFavoriteEntry(display, UUID.randomUUID()), Lifecycle.stable()); } -- cgit