diff options
| author | shedaniel <daniel@shedaniel.me> | 2023-05-28 04:09:32 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2023-05-28 04:09:32 +0800 |
| commit | a35425108d9813f64779b519fedd4744a7eb6072 (patch) | |
| tree | e6cb499ea73182955527205cdec053abf7d74012 /api/src/main/java | |
| parent | e11f3e6de3d0d3708061b765fb77dee0746aaf83 (diff) | |
| download | RoughlyEnoughItems-a35425108d9813f64779b519fedd4744a7eb6072.tar.gz RoughlyEnoughItems-a35425108d9813f64779b519fedd4744a7eb6072.tar.bz2 RoughlyEnoughItems-a35425108d9813f64779b519fedd4744a7eb6072.zip | |
Update to 1.20-pre6
Diffstat (limited to 'api/src/main/java')
24 files changed, 113 insertions, 205 deletions
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/entry/renderer/AbstractEntryRenderer.java b/api/src/main/java/me/shedaniel/rei/api/client/entry/renderer/AbstractEntryRenderer.java deleted file mode 100644 index 9f8db359c..000000000 --- a/api/src/main/java/me/shedaniel/rei/api/client/entry/renderer/AbstractEntryRenderer.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This file is licensed under the MIT License, part of Roughly Enough Items. - * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 shedaniel - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package me.shedaniel.rei.api.client.entry.renderer; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.gui.GuiComponent; - -@Environment(EnvType.CLIENT) -public abstract class AbstractEntryRenderer<T> extends GuiComponent implements EntryRenderer<T> { -} diff --git a/api/src/main/java/me/shedaniel/rei/api/client/entry/renderer/BatchedEntryRenderer.java b/api/src/main/java/me/shedaniel/rei/api/client/entry/renderer/BatchedEntryRenderer.java index 91267859d..eaf030ccf 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/entry/renderer/BatchedEntryRenderer.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/entry/renderer/BatchedEntryRenderer.java @@ -29,6 +29,7 @@ import me.shedaniel.rei.api.common.entry.EntryStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.MultiBufferSource; /** @@ -77,37 +78,41 @@ public interface BatchedEntryRenderer<T, E> extends EntryRenderer<T> { * * @param entry the first entry in the batch * @param extraData the extra data returned from {@link #getExtraData(EntryStack)} - * @param matrices the matrix stack + * @param graphics the graphics context * @param delta the tick delta */ - void startBatch(EntryStack<T> entry, E extraData, PoseStack matrices, float delta); + void startBatch(EntryStack<T> entry, E extraData, GuiGraphics graphics, float delta); - void renderBase(EntryStack<T> entry, E extraData, PoseStack matrices, MultiBufferSource.BufferSource immediate, Rectangle bounds, int mouseX, int mouseY, float delta); + void renderBase(EntryStack<T> entry, E extraData, GuiGraphics graphics, MultiBufferSource.BufferSource immediate, Rectangle bounds, int mouseX, int mouseY, float delta); - void afterBase(EntryStack<T> entry, E extraData, PoseStack matrices, float delta); + void afterBase(EntryStack<T> entry, E extraData, GuiGraphics graphics, float delta); - void renderOverlay(EntryStack<T> entry, E extraData, PoseStack matrices, MultiBufferSource.BufferSource immediate, Rectangle bounds, int mouseX, int mouseY, float delta); + void renderOverlay(EntryStack<T> entry, E extraData, GuiGraphics graphics, MultiBufferSource.BufferSource immediate, Rectangle bounds, int mouseX, int mouseY, float delta); /** * Ends the batch rendering, used to setup states, only called once with every batch. * * @param entry the first entry in the batch * @param extraData the extra data returned from {@link #getExtraData(EntryStack)} - * @param matrices the matrix stack + * @param graphics the graphics context * @param delta the tick delta */ - void endBatch(EntryStack<T> entry, E extraData, PoseStack matrices, float delta); + void endBatch(EntryStack<T> entry, E extraData, GuiGraphics graphics, float delta); @Override - default void render(EntryStack<T> entry, PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) { - matrices = batchModifyMatrices(matrices); + default void render(EntryStack<T> entry, GuiGraphics graphics, Rectangle bounds, int mouseX, int mouseY, float delta) { + PoseStack newStack = batchModifyMatrices(graphics.pose()); + graphics.pose().pushPose(); + graphics.pose().last().pose().set(newStack.last().pose()); + graphics.pose().last().normal().set(newStack.last().normal()); E data = getExtraData(entry); - startBatch(entry, data, matrices, delta); + startBatch(entry, data, graphics, delta); MultiBufferSource.BufferSource immediate = Minecraft.getInstance().renderBuffers().bufferSource(); - renderBase(entry, data, matrices, immediate, bounds, mouseX, mouseY, delta); + renderBase(entry, data, graphics, immediate, bounds, mouseX, mouseY, delta); immediate.endBatch(); - renderOverlay(entry, data, matrices, immediate, bounds, mouseX, mouseY, delta); + renderOverlay(entry, data, graphics, immediate, bounds, mouseX, mouseY, delta); immediate.endBatch(); - endBatch(entry, data, matrices, delta); + endBatch(entry, data, graphics, delta); + graphics.pose().popPose(); } }
\ No newline at end of file diff --git a/api/src/main/java/me/shedaniel/rei/api/client/entry/renderer/EntryRenderer.java b/api/src/main/java/me/shedaniel/rei/api/client/entry/renderer/EntryRenderer.java index 81bb56d15..0f1706604 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/entry/renderer/EntryRenderer.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/entry/renderer/EntryRenderer.java @@ -23,7 +23,6 @@ package me.shedaniel.rei.api.client.entry.renderer; -import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.gui.widgets.Tooltip; import me.shedaniel.rei.api.client.gui.widgets.TooltipContext; @@ -31,6 +30,7 @@ import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.impl.ClientInternals; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.gui.GuiGraphics; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; @@ -49,7 +49,7 @@ public interface EntryRenderer<T> extends EntryRendererProvider<T> { } @Environment(EnvType.CLIENT) - void render(EntryStack<T> entry, PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta); + void render(EntryStack<T> entry, GuiGraphics graphics, Rectangle bounds, int mouseX, int mouseY, float delta); @Nullable @Environment(EnvType.CLIENT) diff --git a/api/src/main/java/me/shedaniel/rei/api/client/entry/renderer/ForwardingEntryRenderer.java b/api/src/main/java/me/shedaniel/rei/api/client/entry/renderer/ForwardingEntryRenderer.java index 1bdaa2387..907e34b79 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/entry/renderer/ForwardingEntryRenderer.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/entry/renderer/ForwardingEntryRenderer.java @@ -23,11 +23,11 @@ package me.shedaniel.rei.api.client.entry.renderer; -import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.gui.widgets.Tooltip; import me.shedaniel.rei.api.client.gui.widgets.TooltipContext; import me.shedaniel.rei.api.common.entry.EntryStack; +import net.minecraft.client.gui.GuiGraphics; import org.jetbrains.annotations.Nullable; public abstract class ForwardingEntryRenderer<T> implements EntryRenderer<T> { @@ -38,8 +38,8 @@ public abstract class ForwardingEntryRenderer<T> implements EntryRenderer<T> { } @Override - public void render(EntryStack<T> entry, PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) { - this.next.render(entry, matrices, bounds, mouseX, mouseY, delta); + public void render(EntryStack<T> entry, GuiGraphics graphics, Rectangle bounds, int mouseX, int mouseY, float delta) { + this.next.render(entry, graphics, bounds, mouseX, mouseY, delta); } @Override 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 e59f2dcf2..bc1a4998e 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 @@ -23,16 +23,15 @@ package me.shedaniel.rei.api.client.favorites; -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; import me.shedaniel.math.Rectangle; -import me.shedaniel.rei.api.client.gui.AbstractRenderer; import me.shedaniel.rei.api.client.gui.Renderer; 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; @@ -40,7 +39,7 @@ import java.util.function.IntFunction; import java.util.function.IntSupplier; @Environment(EnvType.CLIENT) -public class CompoundFavoriteRenderer extends AbstractRenderer { +public class CompoundFavoriteRenderer implements Renderer { protected NumberAnimator<Double> offset = ValueAnimator.ofDouble(); protected Rectangle scissorArea = new Rectangle(); protected long nextSwitch = -1; @@ -89,21 +88,21 @@ public class CompoundFavoriteRenderer extends AbstractRenderer { } @Override - public void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) { + 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); - matrices.last().pose().transform(vector4f); + graphics.pose().last().pose().transform(vector4f); Vector4f vector4f2 = new Vector4f(bounds.getMaxX(), bounds.getMaxY(), 0, 1.0F); - matrices.last().pose().transform(vector4f2); + 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()); ScissorsHandler.INSTANCE.scissor(scissorArea); - matrices.pushPose(); - matrices.translate(0, this.offset.floatValue() * -bounds.getHeight(), 0); + graphics.pose().pushPose(); + graphics.pose().translate(0, this.offset.floatValue() * -bounds.getHeight(), 0); for (int i = 0; i < count; i++) { - renderers.apply(i).render(matrices, bounds, mouseX, mouseY, delta); - matrices.translate(0, bounds.height, 0); + renderers.apply(i).render(graphics, bounds, mouseX, mouseY, delta); + graphics.pose().translate(0, bounds.height, 0); } - matrices.popPose(); + graphics.pose().popPose(); ScissorsHandler.INSTANCE.removeLastScissor(); } diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/AbstractContainerEventHandler.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/AbstractContainerEventHandler.java index 0efc48699..52f55d463 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/gui/AbstractContainerEventHandler.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/AbstractContainerEventHandler.java @@ -25,13 +25,12 @@ package me.shedaniel.rei.api.client.gui; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.gui.GuiComponent; import net.minecraft.client.gui.components.events.ContainerEventHandler; import net.minecraft.client.gui.components.events.GuiEventListener; import org.jetbrains.annotations.Nullable; @Environment(EnvType.CLIENT) -public abstract class AbstractContainerEventHandler extends GuiComponent implements ContainerEventHandler { +public abstract class AbstractContainerEventHandler implements ContainerEventHandler { @Nullable private GuiEventListener focused; private boolean isDragging; diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/AbstractRenderer.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/AbstractRenderer.java deleted file mode 100644 index 45d9d293e..000000000 --- a/api/src/main/java/me/shedaniel/rei/api/client/gui/AbstractRenderer.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * This file is licensed under the MIT License, part of Roughly Enough Items. - * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 shedaniel - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package me.shedaniel.rei.api.client.gui; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.gui.GuiComponent; - -@Environment(EnvType.CLIENT) -public abstract class AbstractRenderer extends GuiComponent implements Renderer { - private int z; - - @Override - public int getZ() { - return z; - } - - @Override - public void setZ(int z) { - this.z = z; - } -} diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/DisplayRenderer.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/DisplayRenderer.java index 81a12b339..71a422e05 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/gui/DisplayRenderer.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/DisplayRenderer.java @@ -32,7 +32,7 @@ import org.jetbrains.annotations.Nullable; @ApiStatus.OverrideOnly @Environment(EnvType.CLIENT) -public abstract class DisplayRenderer extends AbstractRenderer { +public abstract class DisplayRenderer implements Renderer { public abstract int getHeight(); public final int getWidth() { diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/DrawableConsumer.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/DrawableConsumer.java index 81de923c6..2decb581c 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/gui/DrawableConsumer.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/DrawableConsumer.java @@ -23,15 +23,14 @@ package me.shedaniel.rei.api.client.gui; -import com.mojang.blaze3d.vertex.PoseStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.GuiGraphics; /** - * Consumer of a {@link GuiComponent} and information of mouse and delta. + * Consumer of a {@link GuiGraphics} and information of mouse and delta. */ @Environment(EnvType.CLIENT) public interface DrawableConsumer { - void render(GuiComponent helper, PoseStack matrices, int mouseX, int mouseY, float delta); + void render(GuiGraphics graphics, int mouseX, int mouseY, float delta); } diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/Renderer.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/Renderer.java index 1c0547b44..3a5d7ebe1 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/gui/Renderer.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/Renderer.java @@ -23,7 +23,6 @@ package me.shedaniel.rei.api.client.gui; -import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.gui.widgets.Tooltip; import me.shedaniel.rei.api.client.gui.widgets.TooltipContext; @@ -32,11 +31,12 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.CrashReport; import net.minecraft.CrashReportCategory; +import net.minecraft.client.gui.GuiGraphics; import org.jetbrains.annotations.Nullable; public interface Renderer { @Environment(EnvType.CLIENT) - void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta); + void render(GuiGraphics graphics, Rectangle bounds, int mouseX, int mouseY, float delta); @Nullable @Environment(EnvType.CLIENT) @@ -44,15 +44,8 @@ public interface Renderer { return null; } - @Environment(EnvType.CLIENT) - int getZ(); - - @Environment(EnvType.CLIENT) - void setZ(int z); - default void fillCrashReport(CrashReport report, CrashReportCategory category) { category.setDetail("Renderer name", () -> getClass().getCanonicalName()); - category.setDetail("Z level", () -> String.valueOf(getZ())); if (this instanceof WidgetWithBounds widget) { category.setDetail("Bounds", () -> String.valueOf(widget.getBounds())); } diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/SimpleDisplayRenderer.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/SimpleDisplayRenderer.java index 30774e4da..f62ec2491 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/gui/SimpleDisplayRenderer.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/SimpleDisplayRenderer.java @@ -24,8 +24,6 @@ package me.shedaniel.rei.api.client.gui; import com.google.common.base.Predicates; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import it.unimi.dsi.fastutil.longs.LongSet; import me.shedaniel.math.Point; @@ -36,6 +34,7 @@ import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.entry.type.EntryDefinition; import me.shedaniel.rei.api.common.util.CollectionUtils; import me.shedaniel.rei.api.common.util.EntryStacks; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; @@ -116,14 +115,15 @@ public class SimpleDisplayRenderer extends DisplayRenderer implements WidgetHold } @Override - public void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) { + public void render(GuiGraphics graphics, Rectangle bounds, int mouseX, int mouseY, float delta) { int xx = bounds.x + 4, yy = bounds.y + 2; int j = 0; int itemsPerLine = getItemsPerLine(); + graphics.pose().pushPose(); + graphics.pose().translate(0, 0, 50); for (Slot entryWidget : inputWidgets) { - entryWidget.setZ(getZ() + 50); entryWidget.getBounds().setLocation(xx, yy); - entryWidget.render(matrices, mouseX, mouseY, delta); + entryWidget.render(graphics, mouseX, mouseY, delta); xx += 18; j++; if (j >= getItemsPerLine() - 2) { @@ -132,18 +132,20 @@ public class SimpleDisplayRenderer extends DisplayRenderer implements WidgetHold j = 0; } } + graphics.pose().popPose(); xx = bounds.x + 4 + 18 * (getItemsPerLine() - 2); yy = bounds.y + getHeight() / 2 - 8; - RenderSystem.setShaderTexture(0, CHEST_GUI_TEXTURE); - blit(matrices, xx, yy, 0, 28, 18, 18); + graphics.blit(CHEST_GUI_TEXTURE, xx, yy, 0, 28, 18, 18); xx += 18; yy += outputWidgets.size() * -9 + 9; + graphics.pose().pushPose(); + graphics.pose().translate(0, 0, 50); for (Slot outputWidget : outputWidgets) { - outputWidget.setZ(getZ() + 50); outputWidget.getBounds().setLocation(xx, yy); - outputWidget.render(matrices, mouseX, mouseY, delta); + outputWidget.render(graphics, mouseX, mouseY, delta); yy += 18; } + graphics.pose().popPose(); } @Nullable diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStack.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStack.java index 2be42790b..42fcc9605 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStack.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStack.java @@ -23,11 +23,11 @@ package me.shedaniel.rei.api.client.gui.drag; -import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.gui.drag.component.DraggableComponent; import me.shedaniel.rei.api.common.entry.EntryStack; +import net.minecraft.client.gui.GuiGraphics; public interface DraggableStack extends DraggableComponent<EntryStack<?>> { static DraggableStack from(DraggableComponent<EntryStack<?>> component) { @@ -48,13 +48,13 @@ public interface DraggableStack extends DraggableComponent<EntryStack<?>> { } @Override - public void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) { - component.render(matrices, bounds, mouseX, mouseY, delta); + public void render(GuiGraphics graphics, Rectangle bounds, int mouseX, int mouseY, float delta) { + component.render(graphics, bounds, mouseX, mouseY, delta); } @Override - public void render(PoseStack matrices, Point position, int mouseX, int mouseY, float delta) { - component.render(matrices, position, mouseX, mouseY, delta); + public void render(GuiGraphics graphics, Point position, int mouseX, int mouseY, float delta) { + component.render(graphics, position, mouseX, mouseY, delta); } }; } @@ -82,7 +82,7 @@ public interface DraggableStack extends DraggableComponent<EntryStack<?>> { } @Override - default void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) { - getStack().render(matrices, bounds, mouseX, mouseY, delta); + default void render(GuiGraphics graphics, Rectangle bounds, int mouseX, int mouseY, float delta) { + getStack().render(graphics, bounds, mouseX, mouseY, delta); } }
\ No newline at end of file diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/component/DraggableComponent.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/component/DraggableComponent.java index 5d8493cd1..71e0afe2c 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/component/DraggableComponent.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/drag/component/DraggableComponent.java @@ -23,10 +23,10 @@ package me.shedaniel.rei.api.client.gui.drag.component; -import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.gui.drag.DraggedAcceptorResult; +import net.minecraft.client.gui.GuiGraphics; import java.util.Optional; import java.util.function.Consumer; @@ -74,10 +74,10 @@ public interface DraggableComponent<T> extends Supplier<T> { default void release(DraggedAcceptorResult result) { } - default void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) { + default void render(GuiGraphics graphics, Rectangle bounds, int mouseX, int mouseY, float delta) { } - default void render(PoseStack matrices, Point position, int mouseX, int mouseY, float delta) { - render(matrices, new Rectangle(position.x - getWidth() / 2, position.y - getHeight() / 2, getWidth(), getHeight()), mouseX, mouseY, delta); + default void render(GuiGraphics graphics, Point position, int mouseX, int mouseY, float delta) { + render(graphics, new Rectangle(position.x - getWidth() / 2, position.y - getHeight() / 2, getWidth(), getHeight()), mouseX, mouseY, delta); } } diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Button.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Button.java index f36f903eb..4705c3969 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Button.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Button.java @@ -23,8 +23,8 @@ package me.shedaniel.rei.api.client.gui.widgets; -import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.math.Point; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import org.jetbrains.annotations.Nullable; @@ -97,11 +97,11 @@ public abstract class Button extends BaseWidget<Button> { } @Nullable - public abstract BiConsumer<PoseStack, Button> getOnRender(); + public abstract BiConsumer<GuiGraphics, Button> getOnRender(); - public abstract void setOnRender(@Nullable BiConsumer<PoseStack, Button> onRender); + public abstract void setOnRender(@Nullable BiConsumer<GuiGraphics, Button> onRender); - public final Button onRender(@Nullable BiConsumer<PoseStack, Button> onRender) { + public final Button onRender(@Nullable BiConsumer<GuiGraphics, Button> onRender) { setOnRender(onRender); return this; } diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/DelegateWidget.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/DelegateWidget.java index b33f33f0f..5dd7c5a00 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/DelegateWidget.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/DelegateWidget.java @@ -23,8 +23,8 @@ package me.shedaniel.rei.api.client.gui.widgets; -import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.math |
