aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2025-04-12 16:42:58 +0800
committershedaniel <daniel@shedaniel.me>2025-04-12 16:42:58 +0800
commite0f7553d6eaa7a702b37143d07f0d9627797d93a (patch)
tree5f438e8054d3332bb7a8c4d7fc3287865dbba3d6
parent098fb7b5dae7bbe4a7dc439e90455e4d9d2359ed (diff)
downloadRoughlyEnoughItems-e0f7553d6eaa7a702b37143d07f0d9627797d93a.tar.gz
RoughlyEnoughItems-e0f7553d6eaa7a702b37143d07f0d9627797d93a.tar.bz2
RoughlyEnoughItems-e0f7553d6eaa7a702b37143d07f0d9627797d93a.zip
Fix scissoring
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/favorites/CompoundFavoriteRenderer.java8
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Widget.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionWidget.java3
3 files changed, 2 insertions, 11 deletions
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/favorites/CompoundFavoriteRenderer.java b/api/src/main/java/me/shedaniel/rei/api/client/favorites/CompoundFavoriteRenderer.java
index ad1c7b3b2..b00381a07 100644
--- a/api/src/main/java/me/shedaniel/rei/api/client/favorites/CompoundFavoriteRenderer.java
+++ b/api/src/main/java/me/shedaniel/rei/api/client/favorites/CompoundFavoriteRenderer.java
@@ -32,7 +32,6 @@ import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.Util;
import net.minecraft.client.gui.GuiGraphics;
-import org.joml.Vector4f;
import java.util.List;
import java.util.function.IntFunction;
@@ -90,12 +89,7 @@ public class CompoundFavoriteRenderer implements Renderer {
@Override
public void render(GuiGraphics graphics, Rectangle bounds, int mouseX, int mouseY, float delta) {
updateAnimator(delta);
- Vector4f vector4f = new Vector4f(bounds.x, bounds.y, 0, 1.0F);
- graphics.pose().last().pose().transform(vector4f);
- Vector4f vector4f2 = new Vector4f(bounds.getMaxX(), bounds.getMaxY(), 0, 1.0F);
- graphics.pose().last().pose().transform(vector4f2);
- scissorArea.setBounds((int) vector4f.x(), (int) vector4f.y(), (int) vector4f2.x() - (int) vector4f.x(), (int) vector4f2.y() - (int) vector4f.y());
- graphics.enableScissor(scissorArea.x, scissorArea.y, scissorArea.getMaxX(), scissorArea.getMaxY());
+ graphics.enableScissor(bounds.x, bounds.y, bounds.getMaxX(), bounds.getMaxY());
graphics.pose().pushPose();
graphics.pose().translate(0, this.offset.floatValue() * -bounds.getHeight(), 0);
for (int i = 0; i < count; i++) {
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Widget.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Widget.java
index 06a770620..499383833 100644
--- a/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Widget.java
+++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Widget.java
@@ -29,7 +29,6 @@ import me.shedaniel.math.Rectangle;
import me.shedaniel.math.impl.PointHelper;
import me.shedaniel.rei.api.client.gui.AbstractContainerEventHandler;
import me.shedaniel.rei.api.client.gui.Renderer;
-import me.shedaniel.rei.api.client.util.MatrixUtils;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.Minecraft;
@@ -119,7 +118,6 @@ public abstract class Widget extends AbstractContainerEventHandler implements Re
@ApiStatus.Experimental
public static CloseableScissors scissor(GuiGraphics graphics, Rectangle bounds) {
- bounds = MatrixUtils.transform(graphics.pose().last().pose(), bounds);
graphics.enableScissor(bounds.x, bounds.y, bounds.getMaxX(), bounds.getMaxY());
return graphics::disableScissor;
}
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 efb37f455..015dc1c75 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
@@ -31,7 +31,6 @@ import me.shedaniel.rei.api.client.gui.widgets.Label;
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.client.util.MatrixUtils;
import me.shedaniel.rei.impl.client.gui.config.ConfigAccess;
import me.shedaniel.rei.impl.client.gui.config.options.AllREIConfigOptions;
import me.shedaniel.rei.impl.client.gui.config.options.CompositeOption;
@@ -127,7 +126,7 @@ public class ConfigOptionWidget {
this.previewLabel.render(graphics, mouseX, mouseY, delta);
if (this.preview != null && this.previewHeight.value() > 0.1f) {
- Rectangle rectangle = MatrixUtils.transform(graphics.pose().last().pose(), new Rectangle(0, 24 + 12 * split.size() - (nextLinePreview ? 0 : 12), width, this.previewHeight.value()));
+ Rectangle rectangle = new Rectangle(0, 24 + 12 * split.size() - (nextLinePreview ? 0 : 12), width, this.previewHeight.value());
graphics.enableScissor(rectangle.x, rectangle.y, rectangle.getMaxX(), rectangle.getMaxY());
this.previewTranslation = new Matrix4f().translate(0, 12 + 12 * split.size(), 100);
this.preview.render(graphics, mouseX, mouseY, delta);