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 /default-plugin/src | |
| parent | e11f3e6de3d0d3708061b765fb77dee0746aaf83 (diff) | |
| download | RoughlyEnoughItems-a35425108d9813f64779b519fedd4744a7eb6072.tar.gz RoughlyEnoughItems-a35425108d9813f64779b519fedd4744a7eb6072.tar.bz2 RoughlyEnoughItems-a35425108d9813f64779b519fedd4744a7eb6072.zip | |
Update to 1.20-pre6
Diffstat (limited to 'default-plugin/src')
13 files changed, 119 insertions, 119 deletions
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultBrewingCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultBrewingCategory.java index 19d614393..e44fc7126 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultBrewingCategory.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultBrewingCategory.java @@ -24,7 +24,6 @@ package me.shedaniel.rei.plugin.client.categories; import com.google.common.collect.Lists; -import com.mojang.blaze3d.systems.RenderSystem; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.REIRuntime; @@ -39,6 +38,7 @@ import me.shedaniel.rei.plugin.common.displays.brewing.DefaultBrewingDisplay; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Blocks; @@ -67,11 +67,11 @@ public class DefaultBrewingCategory implements DisplayCategory<DefaultBrewingDis Point startPoint = new Point(bounds.getCenterX() - 52, bounds.getCenterY() - 29); List<Widget> widgets = Lists.newArrayList(); widgets.add(Widgets.createRecipeBase(bounds)); - widgets.add(Widgets.createDrawableWidget((helper, matrices, mouseX, mouseY, delta) -> { - RenderSystem.setShaderTexture(0, REIRuntime.getInstance().getDefaultDisplayTexture()); - helper.blit(matrices, startPoint.x, startPoint.y, 0, 108, 103, 59); + widgets.add(Widgets.createDrawableWidget((graphics, mouseX, mouseY, delta) -> { + ResourceLocation texture = REIRuntime.getInstance().getDefaultDisplayTexture(); + graphics.blit(texture, startPoint.x, startPoint.y, 0, 108, 103, 59); int width = Mth.ceil(System.currentTimeMillis() / 250d % 18d); - helper.blit(matrices, startPoint.x + 44, startPoint.y + 28, 103, 163, width, 4); + graphics.blit(texture, startPoint.x + 44, startPoint.y + 28, 103, 163, width, 4); })); widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)).entry(EntryStacks.of(Items.BLAZE_POWDER)).disableBackground().markInput()); widgets.add(Widgets.createSlot(new Point(startPoint.x + 40, startPoint.y + 1)).entries(display.getInputEntries().get(0)).disableBackground().markInput()); diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultCompostingCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultCompostingCategory.java index c0d2a08b6..27005fee2 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultCompostingCategory.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultCompostingCategory.java @@ -41,6 +41,7 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.util.Mth; import net.minecraft.world.item.ItemStack; @@ -78,8 +79,8 @@ public class DefaultCompostingCategory implements DisplayCategory<DefaultCompost } @Override - public void render(PoseStack matrices, Rectangle rectangle, int mouseX, int mouseY, float delta) { - Minecraft.getInstance().font.draw(matrices, text.getVisualOrderText(), rectangle.x + 5, rectangle.y + 6, -1); + public void render(GuiGraphics graphics, Rectangle rectangle, int mouseX, int mouseY, float delta) { + graphics.drawString(Minecraft.getInstance().font, text.getVisualOrderText(), rectangle.x + 5, rectangle.y + 6, -1, false); } }; } diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultFuelCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultFuelCategory.java index ba2329722..2f1157a13 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultFuelCategory.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultFuelCategory.java @@ -24,7 +24,6 @@ package me.shedaniel.rei.plugin.client.categories; import com.google.common.collect.Lists; -import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.gui.DisplayRenderer; @@ -38,6 +37,7 @@ import me.shedaniel.rei.plugin.common.displays.DefaultFuelDisplay; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.item.Items; import org.jetbrains.annotations.Nullable; @@ -103,11 +103,13 @@ public class DefaultFuelCategory implements DisplayCategory<DefaultFuelDisplay> } @Override - public void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) { - slot.setZ(getZ() + 50); + public void render(GuiGraphics graphics, Rectangle bounds, int mouseX, int mouseY, float delta) { + graphics.pose().pushPose(); + graphics.pose().translate(0, 0, 50); slot.getBounds().setLocation(bounds.x + 4, bounds.y + 2); - slot.render(matrices, mouseX, mouseY, delta); - Minecraft.getInstance().font.drawShadow(matrices, text.getVisualOrderText(), bounds.x + 25, bounds.y + 8, -1); + slot.render(graphics, mouseX, mouseY, delta); + graphics.pose().popPose(); + graphics.drawString(Minecraft.getInstance().font, text.getVisualOrderText(), bounds.x + 25, bounds.y + 8, -1); } }; } diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultInformationCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultInformationCategory.java index 7c7399df0..38de0e376 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultInformationCategory.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultInformationCategory.java @@ -31,7 +31,6 @@ import me.shedaniel.clothconfig2.api.scroll.ScrollingContainer; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.REIRuntime; -import me.shedaniel.rei.api.client.gui.AbstractRenderer; import me.shedaniel.rei.api.client.gui.DisplayRenderer; import me.shedaniel.rei.api.client.gui.Renderer; import me.shedaniel.rei.api.client.gui.widgets.CloseableScissors; @@ -45,6 +44,7 @@ import me.shedaniel.rei.plugin.common.displays.DefaultInformationDisplay; 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.gui.components.events.GuiEventListener; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.network.chat.Component; @@ -89,23 +89,23 @@ public class DefaultInformationCategory implements DisplayCategory<DefaultInform } @Override - public void render(PoseStack matrices, Rectangle rectangle, int mouseX, int mouseY, float delta) { - Minecraft.getInstance().font.draw(matrices, name, rectangle.x + 5, rectangle.y + 6, -1); + public void render(GuiGraphics graphics, Rectangle rectangle, int mouseX, int mouseY, float delta) { + graphics.drawString(Minecraft.getInstance().font, name, rectangle.x + 5, rectangle.y + 6, -1, false); } }; } @Override public Renderer getIcon() { - return new AbstractRenderer() { + return new Renderer() { @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) { RenderSystem.setShaderTexture(0, REIRuntime.getInstance().getDefaultDisplayTexture()); - matrices.pushPose(); - matrices.translate(-1.2f, -1, 0); - Matrix4f matrix = matrices.last().pose(); + graphics.pose().pushPose(); + graphics.pose().translate(-1.2f, -1, 0); + Matrix4f matrix = graphics.pose().last().pose(); DefaultInformationCategory.innerBlit(matrix, bounds.getCenterX() - 8, bounds.getCenterX() + 8, bounds.getCenterY() - 8, bounds.getCenterY() + 8, 0, 116f / 256f, (116f + 16f) / 256f, 0f, 16f / 256f); - matrices.popPose(); + graphics.pose().popPose(); } }; } @@ -189,28 +189,28 @@ public class DefaultInformationCategory implements DisplayCategory<DefaultInform } @Override - public void render(PoseStack matrices, int mouseX, int mouseY, float delta) { + public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { scrolling.updatePosition(delta); Rectangle innerBounds = scrolling.getScissorBounds(); - try (CloseableScissors scissors = scissor(matrices, innerBounds)) { + try (CloseableScissors scissors = scissor(graphics, innerBounds)) { int currentY = -scrolling.scrollAmountInt() + innerBounds.y; for (FormattedCharSequence text : texts) { if (text != null && currentY + font.lineHeight >= innerBounds.y && currentY <= innerBounds.getMaxY()) { - font.draw(matrices, text, innerBounds.x + 2, currentY + 2, REIRuntime.getInstance().isDarkThemeEnabled() ? 0xFFBBBBBB : 0xFF090909); + graphics.drawString(font, text, innerBounds.x + 2, currentY + 2, REIRuntime.getInstance().isDarkThemeEnabled() ? 0xFFBBBBBB : 0xFF090909, false); } currentY += text == null ? 4 : font.lineHeight; } } if (scrolling.hasScrollBar()) { if (scrolling.scrollAmount() > 8) { - fillGradient(matrices, innerBounds.x, innerBounds.y, innerBounds.getMaxX(), innerBounds.y + 16, 0xFFC6C6C6, 0x00C6C6C6); + graphics.fillGradient(innerBounds.x, innerBounds.y, innerBounds.getMaxX(), innerBounds.y + 16, 0xFFC6C6C6, 0x00C6C6C6); } if (scrolling.getMaxScroll() - scrolling.scrollAmount() > 8) { - fillGradient(matrices, innerBounds.x, innerBounds.getMaxY() - 16, innerBounds.getMaxX(), innerBounds.getMaxY(), 0x00C6C6C6, 0xFFC6C6C6); + graphics.fillGradient(innerBounds.x, innerBounds.getMaxY() - 16, innerBounds.getMaxX(), innerBounds.getMaxY(), 0x00C6C6C6, 0xFFC6C6C6); } } - try (CloseableScissors scissors = scissor(matrices, scrolling.getBounds())) { - scrolling.renderScrollBar(0, 1, 1f); + try (CloseableScissors scissors = scissor(graphics, scrolling.getBounds())) { + scrolling.renderScrollBar(graphics, 0, 1, 1f); } } diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/beacon/DefaultBeaconBaseCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/beacon/DefaultBeaconBaseCategory.java index 7c49b9233..0c068776d 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/beacon/DefaultBeaconBaseCategory.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/beacon/DefaultBeaconBaseCategory.java @@ -24,7 +24,6 @@ package me.shedaniel.rei.plugin.client.categories.beacon; import com.google.common.collect.Lists; -import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.clothconfig2.ClothConfigInitializer; import me.shedaniel.clothconfig2.api.scroll.ScrollingContainer; import me.shedaniel.math.Point; @@ -40,6 +39,7 @@ import me.shedaniel.rei.api.common.util.EntryStacks; import me.shedaniel.rei.plugin.common.BuiltinPlugin; import me.shedaniel.rei.plugin.common.displays.beacon.DefaultBeaconBaseDisplay; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.network.chat.Component; import net.minecraft.util.Mth; @@ -74,8 +74,8 @@ public class DefaultBeaconBaseCategory implements DisplayCategory<DefaultBeaconB } @Override - public void render(PoseStack matrices, Rectangle rectangle, int mouseX, int mouseY, float delta) { - Minecraft.getInstance().font.draw(matrices, name, rectangle.x + 5, rectangle.y + 6, -1); + public void render(GuiGraphics graphics, Rectangle rectangle, int mouseX, int mouseY, float delta) { + graphics.drawString(Minecraft.getInstance().font, name, rectangle.x + 5, rectangle.y + 6, -1, false); } }; } @@ -150,10 +150,10 @@ public class DefaultBeaconBaseCategory implements DisplayCategory<DefaultBeaconB } @Override - public void render(PoseStack matrices, int mouseX, int mouseY, float delta) { + public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { scrolling.updatePosition(delta); Rectangle innerBounds = scrolling.getScissorBounds(); - try (CloseableScissors scissors = scissor(matrices, innerBounds)) { + try (CloseableScissors scissors = scissor(graphics, innerBounds)) { for (int y = 0; y < Mth.ceil(widgets.size() / 8f); y++) { for (int x = 0; x < 8; x++) { int index = y * 8 + x; @@ -161,12 +161,12 @@ public class DefaultBeaconBaseCategory implements DisplayCategory<DefaultBeaconB break; Slot widget = widgets.get(index); widget.getBounds().setLocation(bounds.x + 1 + x * 18, bounds.y + 1 + y * 18 - scrolling.scrollAmountInt()); - widget.render(matrices, mouseX, mouseY, delta); + widget.render(graphics, mouseX, mouseY, delta); } } } - try (CloseableScissors scissors = scissor(matrices, scrolling.getBounds())) { - scrolling.renderScrollBar(0xff000000, 1, REIRuntime.getInstance().isDarkThemeEnabled() ? 0.8f : 1f); + try (CloseableScissors scissors = scissor(graphics, scrolling.getBounds())) { + scrolling.renderScrollBar(graphics, 0xff000000, 1, REIRuntime.getInstance().isDarkThemeEnabled() ? 0.8f : 1f); } } diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/beacon/DefaultBeaconPaymentCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/beacon/DefaultBeaconPaymentCategory.java index 5d74bfea1..c70d6e3bc 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/beacon/DefaultBeaconPaymentCategory.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/beacon/DefaultBeaconPaymentCategory.java @@ -24,7 +24,6 @@ package me.shedaniel.rei.plugin.client.categories.beacon; import com.google.common.collect.Lists; -import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.clothconfig2.ClothConfigInitializer; import me.shedaniel.clothconfig2.api.scroll.ScrollingContainer; import me.shedaniel.math.Point; @@ -40,6 +39,7 @@ import me.shedaniel.rei.api.common.util.EntryStacks; import me.shedaniel.rei.plugin.common.BuiltinPlugin; import me.shedaniel.rei.plugin.common.displays.beacon.DefaultBeaconPaymentDisplay; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.network.chat.Component; import net.minecraft.util.Mth; @@ -74,8 +74,8 @@ public class DefaultBeaconPaymentCategory implements DisplayCategory<DefaultBeac } @Override - public void render(PoseStack matrices, Rectangle rectangle, int mouseX, int mouseY, float delta) { - Minecraft.getInstance().font.draw(matrices, name, rectangle.x + 5, rectangle.y + 6, -1); + public void render(GuiGraphics graphics, Rectangle rectangle, int mouseX, int mouseY, float delta) { + graphics.drawString(Minecraft.getInstance().font, name, rectangle.x + 5, rectangle.y + 6, -1, false); } }; } @@ -150,10 +150,10 @@ public class DefaultBeaconPaymentCategory implements DisplayCategory<DefaultBeac } @Override - public void render(PoseStack matrices, int mouseX, int mouseY, float delta) { + public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { scrolling.updatePosition(delta); Rectangle innerBounds = scrolling.getScissorBounds(); - try (CloseableScissors scissors = scissor(matrices, innerBounds)) { + try (CloseableScissors scissors = scissor(graphics, innerBounds)) { for (int y = 0; y < Mth.ceil(widgets.size() / 8f); y++) { for (int x = 0; x < 8; x++) { int index = y * 8 + x; @@ -161,12 +161,12 @@ public class DefaultBeaconPaymentCategory implements DisplayCategory<DefaultBeac break; Slot widget = widgets.get(index); widget.getBounds().setLocation(bounds.x + 1 + x * 18, bounds.y + 1 + y * 18 - scrolling.scrollAmountInt()); - widget.render(matrices, mouseX, mouseY, delta); + widget.render(graphics, mouseX, mouseY, delta); } } } - try (CloseableScissors scissors = scissor(matrices, scrolling.getBounds())) { - scrolling.renderScrollBar(0xff000000, 1, REIRuntime.getInstance().isDarkThemeEnabled() ? 0.8f : 1f); + try (CloseableScissors scissors = scissor(graphics, scrolling.getBounds())) { + scrolling.renderScrollBar(graphics, 0xff000000, 1, REIRuntime.getInstance().isDarkThemeEnabled() ? 0.8f : 1f); } } diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/DefaultTagCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/DefaultTagCategory.java index f14b1d833..7f0466cd8 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/DefaultTagCategory.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/DefaultTagCategory.java @@ -24,13 +24,11 @@ package me.shedaniel.rei.plugin.client.categories.tag; import com.mojang.blaze3d.platform.Window; -import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.clothconfig2.api.animator.ValueAnimator; import me.shedaniel.math.FloatingRectangle; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.REIRuntime; -import me.shedaniel.rei.api.client.gui.AbstractRenderer; import me.shedaniel.rei.api.client.gui.Renderer; import me.shedaniel.rei.api.client.gui.widgets.*; import me.shedaniel.rei.api.client.registry.display.DisplayCategory; @@ -45,6 +43,7 @@ import me.shedaniel.rei.plugin.common.displays.tag.TagNode; import me.shedaniel.rei.plugin.common.displays.tag.TagNodes; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.core.Holder; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -99,7 +98,7 @@ public class DefaultTagCategory implements DisplayCategory<DefaultTagDisplay<?, } }, 1400); - widgets.add(Widgets.createDrawableWidget((helper, matrices, mouseX, mouseY, delta) -> { + widgets.add(Widgets.createDrawableWidget((matrices, mouseX, mouseY, delta) -> { innerBounds.setBounds(recipeBounds.x + 6 + 14, recipeBounds.y + 6, recipeBounds.width - 12 - 14, recipeBounds.height - 12); overflowBounds.setBounds(innerBounds.x + 1, innerBounds.y + 1, innerBounds.width - 2, innerBounds.height - 2); expandButtonBounds.setBounds(recipeBounds.x + 5, recipeBounds.y + 6, 13, 13); @@ -134,14 +133,17 @@ public class DefaultTagCategory implements DisplayCategory<DefaultTagDisplay<?, Function<Holder<?>, EntryStack<?>> mapper = holder -> { EntryStack<?> stack = ((Function<Holder<?>, EntryStack<?>>) displayMapper).apply(holder); if (stack.isEmpty()) { - return ClientEntryStacks.of(new AbstractRenderer() { + return ClientEntryStacks.of(new Renderer() { @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) { Minecraft instance = Minecraft.getInstance(); Font font = instance.font; String text = "?"; int width = font.width(text); - font.draw(matrices, text, bounds.getCenterX() - width / 2f + 0.2f, bounds.getCenterY() - font.lineHeight / 2f + 1f, REIRuntime.getInstance().isDarkThemeEnabled() ? -4473925 : -12566464); + graphics.pose().pushPose(); + graphics.pose().translate(bounds.getCenterX() - width / 2f + 0.2f, bounds.getCenterY() - font.lineHeight / 2f + 1f, 0); + graphics.drawString(font, text, 0, 0, REIRuntime.getInstance().isDarkThemeEnabled() ? -4473925 : -12566464, false); + graphics.pose().popPose(); } @Override diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/ReferenceTagNodeWidget.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/ReferenceTagNodeWidget.java index 97df68e75..128300f11 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/ReferenceTagNodeWidget.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/ReferenceTagNodeWidget.java @@ -24,7 +24,6 @@ package me.shedaniel.rei.plugin.client.categories.tag; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.gui.widgets.Slot; import me.shedaniel.rei.api.client.gui.widgets.Tooltip; @@ -33,6 +32,7 @@ import me.shedaniel.rei.api.client.util.MatrixUtils; import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.util.EntryIngredients; import me.shedaniel.rei.plugin.common.displays.tag.TagNode; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.core.Holder; @@ -68,15 +68,14 @@ public class ReferenceTagNodeWidget<S, T> extends TagNodeWidget<S, T> { } @Override - public void render(PoseStack poses, int mouseX, int mouseY, float delta) { - if (this.overflowBounds.intersects(MatrixUtils.transform(poses.last().pose(), getBounds()))) { + public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { + if (this.overflowBounds.intersects(MatrixUtils.transform(graphics.pose().last().pose(), getBounds()))) { RenderSystem.setShader(GameRenderer::getPositionTexShader); - RenderSystem.setShaderTexture(0, new ResourceLocation("textures/gui/advancements/widgets.png")); - this.blit(poses, bounds.x, bounds.y, 1, 128 + 27, 24, 24); + graphics.blit(new ResourceLocation("textures/gui/advancements/widgets.png"), bounds.x, bounds.y, 1, 128 + 27, 24, 24); this.slot.getBounds().setLocation(bounds.getCenterX() - this.slot.getBounds().getWidth() / 2, bounds.y + (bounds.height - this.slot.getBounds().getHeight()) / 2 + 1); - this.slot.render(poses, mouseX, mouseY, delta); + this.slot.render(graphics, mouseX, mouseY, delta); if (this.containsMouse(mouseX, mouseY)) { - Tooltip.create(Component.literal("#" + this.node.getReference().location().toString())).queue(); + Tooltip.create(Component.literal("#" + this.node.getReference().location().toString())).queue(); } } } diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/TagTreeWidget.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/TagTreeWidget.java index 3733fbedf..9b5c2747e 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/TagTreeWidget.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/TagTreeWidget.java @@ -23,12 +23,12 @@ package me.shedaniel.rei.plugin.client.categories.tag; -import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.gui.widgets.WidgetWithBounds; import me.shedaniel.rei.api.client.util.MatrixUtils; import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.plugin.common.displays.tag.TagNode; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.core.Holder; @@ -75,24 +75,24 @@ public class TagTreeWidget<S, T> extends WidgetWithBounds { } @Override - public void render(PoseStack poses, int mouseX, int mouseY, float delta) { + public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { this.rootWidget.getBounds().setLocation(getBounds().getCenterX() - this.rootWidget.getBounds().getWidth() / 2, getBounds().y); - this.rootWidget.render(poses, mouseX, mouseY, delta); + this.rootWidget.render(graphics, mouseX, mouseY, delta); if (childWidgets.isEmpty()) return; - vLine(poses, rootWidget.getBounds().getCenterX(), rootWidget.getBounds().getMaxY(), rootWidget.getBounds().getMaxY() + 6, 0xFFFFFFFF); + graphics.vLine(rootWidget.getBounds().getCenterX(), rootWidget.getBounds().getMaxY(), rootWidget.getBounds().getMaxY() + 6, 0xFFFFFFFF); int childrenTotalWidth = childWidgets.stream().map(WidgetWithBounds::getBounds).mapToInt(value -> value.width + 6).sum() - 6; - hLine(poses, rootWidget.getBounds().getCenterX() - childrenTotalWidth / 2 + childWidgets.get(0).getBounds().width / 2, + graphics.hLine(rootWidget.getBounds().getCenterX() - childrenTotalWidth / 2 + childWidgets.get(0).getBounds().width / 2, rootWidget.getBounds().getCenterX() + childrenTotalWidth / 2 - childWidgets.get(childWidgets.size() - 1).getBounds().width / 2, rootWidget.getBounds().getMaxY() + 6, 0xFFFFFFFF); int x = 0; for (TagTreeWidget<S, T> childWidget : this.childWidgets) { - vLine(poses, getBounds().getCenterX() - childrenTotalWidth / 2 + x + childWidget.getBounds().width / 2, + graphics.vLine(getBounds().getCenterX() - childrenTotalWidth / 2 + x + childWidget.getBounds().width / 2, rootWidget.getBounds().getMaxY() + 6, rootWidget.getBounds().getMaxY() + 16, 0xFFFFFFFF); childWidget.getBounds().setLocation(getBounds().getCenterX() - childrenTotalWidth / 2 + x, this.rootWidget.getBounds().getMaxY() + 16); - if (this.overflowBounds.intersects(MatrixUtils.transform(poses.last().pose(), childWidget.getBounds()))) { - childWidget.render(poses, mouseX, mouseY, delta); + if (this.overflowBounds.intersects(MatrixUtils.transform(graphics.pose().last().pose(), childWidget.getBounds()))) { + childWidget.render(graphics, mouseX, mouseY, delta); } x += childWidget.getBounds().width + 6; } diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/ValueTagNodeWidget.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/ValueTagNodeWidget.java index 3f8ae3b9e..a108bdaa6 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/ValueTagNodeWidget.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/tag/ValueTagNodeWidget.java @@ -24,13 +24,13 @@ package me.shedaniel.rei.plugin.client.categories.tag; import com.google.common.base.Predicates; -import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.gui.widgets.*; import me.shedaniel.rei.api.client.util.MatrixUtils; import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.plugin.common.displays.tag.TagNode; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; @@ -81,19 +81,19 @@ public class ValueTagNodeWidget<S, T> extends TagNodeWidget<S, T> { } @Override - public void render(PoseStack poses, int mouseX, int mouseY, float delta) { + public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { Rectangle bounds = getBounds(); - if (this.overflowBounds.intersects(MatrixUtils.transform(poses.last().pose(), bounds))) { - poses.pushPose(); - poses.translate(bounds.x, bounds.y, 0); + if (this.overflowBounds.intersects(MatrixUtils.transform(graphics.pose().last().pose(), bounds))) { + graphics.pose().pushPose(); + graphics.pose().translate(bounds.x, bounds.y, 0); Point mouse = new Point(mouseX - bounds.x, mouseY - bounds.y); for (Widget widget : this.widgets) { if (!(widget instanceof WidgetWithBounds withBounds) || - this.overflowBounds.intersects(MatrixUtils.transform(poses.last().pose(), withBounds.getBounds()))) { - widget.render(poses, mouse.x, mouse.y, delta); + this.overflowBounds.intersects(MatrixUtils.transform(graphics.pose().last().pose(), withBounds.getBounds()))) { + widget.render(graphics, mouse.x, mouse.y, delta); } } - poses.popPose(); + graphics.pose().popPose(); } } diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/GameModeFavoriteEntry.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/GameModeFavoriteEntry.java index 85accd118..d9ae50fe5 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/GameModeFavoriteEntry.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/favorites/GameModeFavoriteEntry.java @@ -23,7 +23,6 @@ package me.shedaniel.rei.plugin.client.favorites; -import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.serialization.DataResult; import com.mojang.serialization.Lifecycle; import me.shedaniel.math.Rectangle; @@ -33,7 +32,6 @@ import me.shedaniel.rei.api.client.favorites.CompoundFavoriteRenderer; import me.shedaniel.rei.api.client.favorites.FavoriteEntry; import me.shedaniel.rei.api.client.favorites.FavoriteEntryType; import me.shedaniel.rei.api.client.favorites.FavoriteMenuEntry; -import me.shedaniel.rei.api.client.gui.AbstractRenderer; import me.shedaniel.rei.api.client.gui.Renderer; import me.shedaniel.rei.api.client.gui.widgets.Tooltip; import me.shedaniel.rei.api.client.gui.widgets.TooltipContext; @@ -41,6 +39,7 @@ import me.shedaniel.rei.api.common.util.CollectionUtils; import net.minecraft.ChatFormatting; |
