aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2024-04-16 01:01:48 +0900
committershedaniel <daniel@shedaniel.me>2024-04-16 01:01:48 +0900
commite190cd1e8b2f5d0f29ab9a001853ff981bd2d251 (patch)
tree1274f2101f0e3981cfafadd5544c97695502ea05 /runtime
parent5b03bcea21701b4dd7b0ae40aec7f448fd3513f3 (diff)
downloadRoughlyEnoughItems-e190cd1e8b2f5d0f29ab9a001853ff981bd2d251.tar.gz
RoughlyEnoughItems-e190cd1e8b2f5d0f29ab9a001853ff981bd2d251.tar.bz2
RoughlyEnoughItems-e190cd1e8b2f5d0f29ab9a001853ff981bd2d251.zip
Fix merge conflicts
Diffstat (limited to 'runtime')
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ConfigureCategoriesScreen.java22
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/REIConfigScreen.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoryEntryWidget.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigGroupWidget.java10
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionValueWidget.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionWidget.java6
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/configure/PanelBoundariesConfiguration.java28
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/InterfacePreviewer.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/TooltipPreviewer.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/CollapsibleEntriesScreen.java15
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/CollapsibleEntryWidget.java30
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/selection/CustomCollapsibleEntrySelectionScreen.java54
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/HoleWidget.java5
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/ListWidget.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/ScrollableViewWidget.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/VStackWidget.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/plugin/client/runtime/DefaultClientRuntimePlugin.java6
17 files changed, 101 insertions, 103 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 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<CategoryIdentifier<?>> hiddenCategories;
private final List<CategoryIdentifier<?>> categoryOrdering;
private ListWidget listWidget;
- public Runnable editedSink = () -> {};
+ public Runnable editedSink = () -> {
+ };
public Screen parent;
public ConfigureCategoriesScreen(Map<CategoryIdentifier<?>, Boolean> filteringQuickCraftCategories, Set<CategoryIdentifier<?>> hiddenCategories, List<CategoryIdentifier<?>> 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<WidgetComposite> 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/sr