diff options
Diffstat (limited to 'src')
38 files changed, 344 insertions, 363 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java b/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java index 2abc643..64d905e 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java @@ -71,7 +71,7 @@ public class SyncedGuiDescription extends ScreenHandler implements GuiDescriptio super(type, syncId); this.blockInventory = null; this.playerInventory = playerInventory; - this.world = playerInventory.player.world; + this.world = playerInventory.player.getWorld(); this.propertyDelegate = null;//new ArrayPropertyDelegate(1); } @@ -88,7 +88,7 @@ public class SyncedGuiDescription extends ScreenHandler implements GuiDescriptio super(type, syncId); this.blockInventory = blockInventory; this.playerInventory = playerInventory; - this.world = playerInventory.player.world; + this.world = playerInventory.player.getWorld(); this.propertyDelegate = propertyDelegate; if (propertyDelegate!=null && propertyDelegate.size()>0) this.addProperties(propertyDelegate); if (blockInventory != null) blockInventory.onOpen(playerInventory.player); diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/BackgroundPainter.java b/src/main/java/io/github/cottonmc/cotton/gui/client/BackgroundPainter.java index 77b7268..f3df523 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/client/BackgroundPainter.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/client/BackgroundPainter.java @@ -1,6 +1,6 @@ package io.github.cottonmc.cotton.gui.client; -import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.gui.DrawContext; import net.minecraft.util.Identifier; import io.github.cottonmc.cotton.gui.impl.LibGuiCommon; @@ -20,11 +20,13 @@ import java.util.function.Consumer; public interface BackgroundPainter { /** * Paint the specified panel to the screen. - * @param left The absolute position of the left of the panel, in gui-screen coordinates - * @param top The absolute position of the top of the panel, in gui-screen coordinates - * @param panel The panel being painted + * + * @param context The draw context + * @param left The absolute position of the left of the panel, in gui-screen coordinates + * @param top The absolute position of the top of the panel, in gui-screen coordinates + * @param panel The panel being painted */ - public void paintBackground(MatrixStack matrices, int left, int top, WWidget panel); + public void paintBackground(DrawContext context, int left, int top, WWidget panel); /** * The {@code VANILLA} background painter draws a vanilla-like GUI panel using nine-patch textures. @@ -47,9 +49,9 @@ public interface BackgroundPainter { * * <p>For {@linkplain WItemSlot item slots}, this painter uses {@link WItemSlot#SLOT_TEXTURE libgui:textures/widget/item_slot.png}. */ - public static BackgroundPainter SLOT = (matrices, left, top, panel) -> { + public static BackgroundPainter SLOT = (context, left, top, panel) -> { if (!(panel instanceof WItemSlot)) { - ScreenDrawing.drawBeveledPanel(matrices, left-1, top-1, panel.getWidth()+2, panel.getHeight()+2, 0xB8000000, 0x4C000000, 0xB8FFFFFF); + ScreenDrawing.drawBeveledPanel(context, left-1, top-1, panel.getWidth()+2, panel.getHeight()+2, 0xB8000000, 0x4C000000, 0xB8FFFFFF); } else { WItemSlot slot = (WItemSlot)panel; for(int x = 0; x < slot.getWidth()/18; ++x) { @@ -59,19 +61,19 @@ public interface BackgroundPainter { if (slot.isBigSlot()) { int sx = (x * 18) + left - 4; int sy = (y * 18) + top - 4; - ScreenDrawing.texturedRect(matrices, sx, sy, 26, 26, WItemSlot.SLOT_TEXTURE, + ScreenDrawing.texturedRect(context, sx, sy, 26, 26, WItemSlot.SLOT_TEXTURE, 18 * px, 0, 44 * px, 26 * px, 0xFF_FFFFFF); if (slot.getFocusedSlot() == index) { - ScreenDrawing.texturedRect(matrices, sx, sy, 26, 26, WItemSlot.SLOT_TEXTURE, + ScreenDrawing.texturedRect(context, sx, sy, 26, 26, WItemSlot.SLOT_TEXTURE, 18 * px, 26 * px, 44 * px, 52 * px, 0xFF_FFFFFF); } } else { int sx = (x * 18) + left; int sy = (y * 18) + top; - ScreenDrawing.texturedRect(matrices, sx, sy, 18, 18, WItemSlot.SLOT_TEXTURE, + ScreenDrawing.texturedRect(context, sx, sy, 18, 18, WItemSlot.SLOT_TEXTURE, 0, 0, 18 * px, 18 * px, 0xFF_FFFFFF); if (slot.getFocusedSlot() == index) { - ScreenDrawing.texturedRect(matrices, sx, sy, 18, 18, WItemSlot.SLOT_TEXTURE, + ScreenDrawing.texturedRect(context, sx, sy, 18, 18, WItemSlot.SLOT_TEXTURE, 0, 26 * px, 18 * px, 44 * px, 0xFF_FFFFFF); } } @@ -85,11 +87,11 @@ public interface BackgroundPainter { * * @param panelColor the panel background color * @return a colorful gui panel painter - * @see ScreenDrawing#drawGuiPanel(MatrixStack, int, int, int, int, int) + * @see ScreenDrawing#drawGuiPanel(DrawContext, int, int, int, int, int) */ public static BackgroundPainter createColorful(int panelColor) { - return (matrices, left, top, panel) -> { - ScreenDrawing.drawGuiPanel(matrices, left, top, panel.getWidth(), panel.getHeight(), panelColor); + return (context, left, top, panel) -> { + ScreenDrawing.drawGuiPanel(context, left, top, panel.getWidth(), panel.getHeight(), panelColor); }; } @@ -101,11 +103,11 @@ public interface BackgroundPainter { * @return a colorful gui panel painter */ public static BackgroundPainter createColorful(int panelColor, float contrast) { - return (matrices, left, top, panel) -> { + return (context, left, top, panel) -> { int shadowColor = ScreenDrawing.multiplyColor(panelColor, 1.0f - contrast); int hilightColor = ScreenDrawing.multiplyColor(panelColor, 1.0f + contrast); - ScreenDrawing.drawGuiPanel(matrices, left, top, panel.getWidth(), panel.getHeight(), shadowColor, panelColor, hilightColor, 0xFF000000); + ScreenDrawing.drawGuiPanel(context, left, top, panel.getWidth(), panel.getHeight(), shadowColor, panelColor, hilightColor, 0xFF000000); }; } @@ -151,9 +153,9 @@ public interface BackgroundPainter { * @since 1.5.0 */ public static BackgroundPainter createLightDarkVariants(BackgroundPainter light, BackgroundPainter dark) { - return (matrices, left, top, panel) -> { - if (panel.shouldRenderInDarkMode()) dark.paintBackground(matrices, left, top, panel); - else light.paintBackground(matrices, left, top, panel); + return (context, left, top, panel) -> { + if (panel.shouldRenderInDarkMode()) dark.paintBackground(context, left, top, panel); + else light.paintBackground(context, left, top, panel); }; } } diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java index 81d7646..310b9aa 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java @@ -1,11 +1,10 @@ package io.github.cottonmc.cotton.gui.client; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.Element; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.screen.ScreenTexts; -import net.minecraft.text.Style; import net.minecraft.text.Text; import io.github.cottonmc.cotton.gui.GuiDescription; @@ -124,41 +123,41 @@ public class CottonClientScreen extends Screen implements CottonScreenImpl { } } - private void paint(MatrixStack matrices, int mouseX, int mouseY) { - renderBackground(matrices); + private void paint(DrawContext context, int mouseX, int mouseY) { + renderBackground(context); if (description!=null) { WPanel root = description.getRootPanel(); if (root!=null) { GL11.glEnable(GL11.GL_SCISSOR_TEST); Scissors.refreshScissors(); - root.paint(matrices, left, top, mouseX-left, mouseY-top); + root.paint(context, left, top, mouseX-left, mouseY-top); GL11.glDisable(GL11.GL_SCISSOR_TEST); Scissors.checkStackIsEmpty(); } if (getTitle() != null && description.isTitleVisible()) { int width = description.getRootPanel().getWidth(); - ScreenDrawing.drawString(matrices, getTitle().asOrderedText(), description.getTitleAlignment(), left + titleX, top + titleY, width - titleX, description.getTitleColor()); + ScreenDrawing.drawString(context, getTitle().asOrderedText(), description.getTitleAlignment(), left + titleX, top + titleY, width - titleX, description.getTitleColor()); } } } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) { - paint(matrices, mouseX, mouseY); + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { + paint(context, mouseX, mouseY); - super.render(matrices, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); if (description!=null) { WPanel root = description.getRootPanel(); if (root!=null) { WWidget hitChild = root.hit(mouseX-left, mouseY-top); - if (hitChild!=null) hitChild.renderTooltip(matrices, left, top, mouseX-left, mouseY-top); + if (hitChild!=null) hitChild.renderTooltip(context, left, top, mouseX-left, mouseY-top); } } - VisualLogger.render(matrices); + VisualLogger.render(context); } @Override @@ -258,11 +257,6 @@ public class CottonClientScreen extends Screen implements CottonScreenImpl { } @Override - public void renderTextHover(MatrixStack matrices, @Nullable Style textStyle, int x, int y) { - renderTextHoverEffect(matrices, textStyle, x, y); - } - - @Override protected void addElementNarrations(NarrationMessageBuilder builder) { if (description != null) NarrationHelper.addNarrations(description.getRootPanel(), builder); } diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonHud.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonHud.java index 05141a7..5dde548 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonHud.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonHud.java @@ -23,7 +23,7 @@ public final class CottonHud { private static final Map<WWidget, Positioner> positioners = new HashMap<>(); static { - HudRenderCallback.EVENT.register((matrices, tickDelta) -> { + HudRenderCallback.EVENT.register((drawContext, tickDelta) -> { Window window = MinecraftClient.getInstance().getWindow(); int hudWidth = window.getScaledWidth(); int hudHeight = window.getScaledHeight(); @@ -33,7 +33,7 @@ public final class CottonHud { positioner.reposition(widget, hudWidth, hudHeight); } - widget.paint(matrices, widget.getX(), widget.getY(), -1, -1); + widget.paint(drawContext, widget.getX(), widget.getY(), -1, -1); } }); diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java index 61fc287..04025a6 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java @@ -1,14 +1,13 @@ package io.github.cottonmc.cotton.gui.client; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.Element; import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder; import net.minecraft.client.render.DiffuseLighting; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.screen.ScreenTexts; -import net.minecraft.text.Style; import net.minecraft.text.Text; import io.github.cottonmc.cotton.gui.GuiDescription; @@ -274,17 +273,17 @@ public class CottonInventoryScreen<T extends SyncedGuiDescription> extends Handl } @Override - protected void drawBackground(MatrixStack matrices, float partialTicks, int mouseX, int mouseY) {} //This is just an AbstractContainerScreen thing; most Screens don't work this way. + protected void drawBackground(DrawContext context, float partialTicks, int mouseX, int mouseY) {} //This is just an AbstractContainerScreen thing; most Screens don't work this way. - private void paint(MatrixStack matrices, int mouseX, int mouseY) { - renderBackground(matrices); + private void paint(DrawContext context, int mouseX, int mouseY) { + renderBackground(context); if (description!=null) { WPanel root = description.getRootPanel(); if (root!=null) { GL11.glEnable(GL11.GL_SCISSOR_TEST); Scissors.refreshScissors(); - root.paint(matrices, x, y, mouseX-x, mouseY-y); + root.paint(context, x, y, mouseX-x, mouseY-y); GL11.glDisable(GL11.GL_SCISSOR_TEST); Scissors.checkStackIsEmpty(); } @@ -292,29 +291,29 @@ public class CottonInventoryScreen<T extends SyncedGuiDescription> extends Handl } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) { - paint(matrices, mouseX, mouseY); + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { + paint(context, mouseX, mouseY); - super.render(matrices, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); DiffuseLighting.disableGuiDepthLighting(); //Needed because super.render leaves dirty state if (description!=null) { WPanel root = description.getRootPanel(); if (root!=null) { WWidget hitChild = root.hit(mouseX-x, mouseY-y); - if (hitChild!=null) hitChild.renderTooltip(matrices, x, y, mouseX-x, mouseY-y); + if (hitChild!=null) hitChild.renderTooltip(context, x, y, mouseX-x, mouseY-y); } } - drawMouseoverTooltip(matrices, mouseX, mouseY); //Draws the itemstack tooltips - VisualLogger.render(matrices); + drawMouseoverTooltip(context, mouseX, mouseY); //Draws the itemstack tooltips + VisualLogger.render(context); } @Override - protected void drawForeground(MatrixStack matrices, int mouseX, int mouseY) { + protected void drawForeground(DrawContext context, int mouseX, int mouseY) { if (description != null && description.isTitleVisible()) { int width = description.getRootPanel().getWidth(); - ScreenDrawing.drawString(matrices, getTitle().asOrderedText(), description.getTitleAlignment(), titleX, titleY, width - titleX, description.getTitleColor()); + ScreenDrawing.drawString(context, getTitle().asOrderedText(), description.getTitleAlignment(), titleX, titleY, width - titleX, description.getTitleColor()); } // Don't draw the player inventory label as it's drawn by the widget itself @@ -332,11 +331,6 @@ public class CottonInventoryScreen<T extends SyncedGuiDescription> extends Handl } @Override - public void renderTextHover(MatrixStack matrices, @Nullable Style textStyle, int x, int y) { - renderTextHoverEffect(matrices, textStyle, x, y); - } - - @Override protected void addElementNarrations(NarrationMessageBuilder builder) { if (description != null) NarrationHelper.addNarrations(description.getRootPanel(), builder); } diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/NinePatchBackgroundPainter.java b/src/main/java/io/github/cottonmc/cotton/gui/client/NinePatchBackgroundPainter.java index 04e7a04..37fa1bf 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/client/NinePatchBackgroundPainter.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/client/NinePatchBackgroundPainter.java @@ -2,7 +2,7 @@ package io.github.cottonmc.cotton.gui.client; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.gui.DrawContext; import net.minecraft.util.Identifier; import io.github.cottonmc.cotton.gui.impl.client.NinePatchTextureRendererImpl; @@ -96,10 +96,11 @@ public final class NinePatchBackgroundPainter implements BackgroundPainter { } @Override - public void paintBackground(MatrixStack matrices, int left, int top, WWidget panel) { + public void paintBackground(DrawContext context, int left, int top, WWidget panel) { + var matrices = context.getMatrices(); matrices.push(); matrices.translate(left - leftPadding, top - topPadding, 0); - ninePatch.draw(NinePatchTextureRendererImpl.INSTANCE, matrices, panel.getWidth() + leftPadding + rightPadding, panel.getHeight() + topPadding + bottomPadding); + ninePatch.draw(NinePatchTextureRendererImpl.INSTANCE, context, panel.getWidth() + leftPadding + rightPadding, panel.getHeight() + topPadding + bottomPadding); matrices.pop(); } } diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java b/src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java index 7af67f1..64e9096 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java @@ -2,19 +2,17 @@ package io.github.cottonmc.cotton.gui.client; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.BufferRenderer; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; import net.minecraft.client.render.VertexFormat; import net.minecraft.client.render.VertexFormats; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.OrderedText; import net.minecraft.text.Style; import net.minecraft.util.Identifier; -import io.github.cottonmc.cotton.gui.impl.client.CottonScreenImpl; import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment; import io.github.cottonmc.cotton.gui.widget.data.Texture; import org.jetbrains.annotations.Nullable; @@ -29,7 +27,7 @@ public class ScreenDrawing { /** * Draws a textured rectangle. * - * @param matrices the rendering matrix stack + * @param context the draw context * @param x the x coordinate of the box on-screen * @param y the y coordinate of the box on-screen * @param width the width of the box on-screen @@ -37,14 +35,14 @@ public class ScreenDrawing { * @param texture the Identifier for the texture * @param color a color to tint the texture. This can be transparent! Use 0xFF_FFFFFF if you don't want a color tint */ - public static void texturedRect(MatrixStack matrices, int x, int y, int width, int height, Identifier texture, int color) { - texturedRect(matrices, x, y, width, height, texture, 0, 0, 1, 1, color, 1.0f); + public static void texturedRect(DrawContext context, int x, int y, int width, int height, Identifier texture, int color) { + texturedRect(context, x, y, width, height, texture, 0, 0, 1, 1, color, 1.0f); } /** * Draws a textured rectangle. * - * @param matrices the rendering matrix stack + * @param context the draw context * @param x the x coordinate of the box on-screen * @param y the y coordinate of the box on-screen * @param width the width of the box on-screen @@ -54,14 +52,14 @@ public class ScreenDrawing { * @param opacity opacity of the drawn texture. (0f is fully opaque and 1f is fully visible) * @since 2.0.0 */ - public static void texturedRect(MatrixStack matrices, int x, int y, int width, int height, Identifier texture, int color, float opacity) { - texturedRect(matrices, x, y, width, height, texture, 0, 0, 1, 1, color, opacity); + public static void texturedRect(DrawContext context, int x, int y, int width, int height, Identifier texture, int color, float opacity) { + texturedRect(context, x, y, width, height, texture, 0, 0, 1, 1, color, opacity); } /** * Draws a textured rectangle. * - * @param matrices the rendering matrix stack + * @param context the draw context * @param x the x coordinate of the box on-screen * @param y the y coordinate of the box on-screen * @param width the width of the box on-screen @@ -73,14 +71,14 @@ public class ScreenDrawing { * @param v2 the bottom edge of the texture * @param color a color to tint the texture. This can be transparent! Use 0xFF_FFFFFF if you don't want a color tint */ - public static void texturedRect(MatrixStack matrices, int x, int y, int width, int height, Identifier texture, float u1, float v1, float u2, float v2, int color) { - texturedRect(matrices, x, y, width, height, texture, u1, v1, u2, v2, color, 1.0f); + public static void texturedRect(DrawContext context, int x, int y, int width, int height, Identifier texture, float u1, float v1, float u2, float v2, int color) { + texturedRect(context, x, y, width, height, texture, u1, v1, u2, v2, color, 1.0f); } /** * Draws a textured rectangle. * - * @param matrices the rendering matrix stack + * @param context the draw context * @param x the x coordinate of the box on-screen * @param y the y coordinate of the box on-screen * @param width the width of the box on-screen @@ -89,14 +87,14 @@ public class ScreenDrawing { * @param color a color to tint the texture. This can be transparent! Use 0xFF_FFFFFF if you don't want a color tint * @since 3.0.0 */ - public static void texturedRect(MatrixStack matrices, int x, int y, int width, int height, Texture texture, int color) { - texturedRect(matrices, x, y, width, height, texture, color, 1.0f); + public static void texturedRect(DrawContext context, int x, int y, int width, int height, Texture texture, int color) { + texturedRect(context, x, y, width, height, texture, color, 1.0f); } /** * Draws a textured rectangle. * - * @param matrices the rendering matrix stack + * @param context the draw context * @param x the x coordinate of the box on-screen * @param y the y coordinate of the box on-screen * @param width the width of the box on-screen @@ -106,14 +104,14 @@ public class ScreenDrawing { * @param opacity opacity of the drawn texture. (0f is fully opaque and 1f is fully visible) * @since 3.0.0 */ - public static void texturedRect(MatrixStack matrices, int x, int y, int width, int height, Texture texture, int color, float opacity) { - texturedRect(matrices, x, y, width, height, texture.image(), texture.u1(), texture.v1(), texture.u2(), texture.v2(), color, opacity); + public static void texturedRect(DrawContext context, int x, int y, int width, int height, Texture texture, int color, float opacity) { + texturedRect(context, x, y, width, height, texture.image(), texture.u1(), texture.v1(), texture.u2(), texture.v2(), color, opacity); } /** * Draws a textured rectangle. * - * @param matrices the rendering matrix stack + * @param context the draw context * @param x the x coordinate of the box on-screen * @param y the y coordinate of the box on-screen * @param width the width of the box on-screen @@ -127,7 +125,7 @@ public class ScreenDrawing { * @param opacity opacity of the drawn texture. (0f is fully opaque and 1f is fully visible) * @since 2.0.0 */ - public static void texturedRect(MatrixStack matrices, int x, int y, int width, int height, Identifier texture, float u1, float v1, float u2, float v2, int color, float opacity) { + public static void texturedRect(DrawContext context, int x, int y, int width, int height, Identifier texture, float u1, float v1, float u2, float v2, int color, float opacity) { if (width <= 0) width = 1; if (height <= 0) height = 1; @@ -136,7 +134,7 @@ public class ScreenDrawing { float b = (color & 255) / 255.0F; Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); - Matrix4f model = matrices.peek().getPositionMatrix(); + Matrix4f model = context.getMatrices().peek().getPositionMatrix(); RenderSystem.enableBlend(); RenderSystem.setShaderTexture(0, texture); RenderSystem.setShaderColor(r, g, b, opacity); @@ -155,7 +153,7 @@ public class ScreenDrawing { * * <p>If the texture is 256x256, this draws the texture at one pixel per texel. * - * @param matrices the rendering matrix stack + * @param context the draw context * @param x the x coordinate of the box on-screen * @param y the y coordinate of the box on-screen * @param width the width of the box on-screen @@ -165,9 +163,9 @@ public class ScreenDrawing { * @param textureY the y offset into the texture * @param color a color to tint the texture. This can be transparent! Use 0xFF_FFFFFF if you don't want a color tint */ - public static void texturedGuiRect(MatrixStack matrices, int x, int y, int width, int height, Identifier texture, int textureX, int textureY, int color) { + public static void texturedGuiRect(DrawContext context, int x, int y, int width, int height, Identifier texture, int textureX, int textureY, int color) { float px = 1/256f; - texturedRect(matrices, x, y, width, height, texture, textureX*px, textureY*px, (textureX+width)*px, (textureY+height)*px, color); + texturedRect(context, x, y, width, height, texture, textureX*px, textureY*px, (textureX+width)*px, (textureY+height)*px, color); } /** @@ -175,7 +173,7 @@ public class ScreenDrawing { * * <p>If the texture is 256x256, this draws the texture at one pixel per texel. * - * @param matrices the rendering matrix stack + * @param context the draw context * @param left the x coordinate of the box on-screen * @param top the y coordinate of the box on-screen * @param width the width of the box on-screen @@ -183,55 +181,55 @@ public class ScreenDrawing { * @param texture the Identifier for the texture * @param color a color to tint the texture. This can be transparent! Use 0xFF_FFFFFF if you don't want a color tint */ - public static void texturedGuiRect(MatrixStack matrices, int left, int top, int width, int height, Identifier texture, int color) { - texturedGuiRect(matrices, left, top, width, height, texture, 0, 0, color); + public static void texturedGuiRect(DrawContext context, int left, int top, int width, int height, Identifier texture, int color) { + texturedGuiRect(context, left, top, width, height, texture, 0, 0, color); } /** * Draws an untextured rectangle of the specified RGB color. */ - public static void coloredRect(MatrixStack matrices, int left, int top, int width, int height, int color) { + public static void coloredRect(DrawContext context, int left, int top, int width, int height, int color) { if (width <= 0) width = 1; if (height <= 0) height = 1; - DrawableHelper.fill(matrices, left, top, left + width, top + height, color); + context.fill(left, top, left + width, top + height, color); } /** * Draws a beveled, round rectangle that is substantially similar to default Minecraft UI panels. |
