aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java4
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/BackgroundPainter.java40
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java26
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonHud.java4
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java32
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/NinePatchBackgroundPainter.java7
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java438
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/impl/VisualLogger.java8
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/impl/client/CottonScreenImpl.java4
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/impl/client/NinePatchTextureRendererImpl.java12
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/impl/modmenu/WKirbSprite.java6
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java24
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java12
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WClippedPanel.java8
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WDynamicLabel.java6
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WItem.java11
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java8
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java8
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java19
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java6
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java8
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java26
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollPanel.java6
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WSlider.java22
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WSprite.java20
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WTabPanel.java12
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java8
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java44
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WTiledSprite.java6
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WToggleButton.java10
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java33
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/icon/Icon.java12
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/icon/ItemIcon.java11
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/icon/TextureIcon.java6
-rw-r--r--src/main/resources/fabric.mod.json6
-rw-r--r--src/testMod/java/io/github/cottonmc/test/TestItemDescription.java6
-rw-r--r--src/testMod/java/io/github/cottonmc/test/client/TestClientGui.java6
-rw-r--r--src/testMod/java/io/github/cottonmc/test/client/WHudTest.java6
38 files changed, 456 insertions, 475 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 0df0597..877528c 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 - 2 * titleX, description.getTitleColor());
+ ScreenDrawing.drawString(context, getTitle().asOrderedText(), description.getTitleAlignment(), left + titleX, top + titleY, width - 2 * 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 013856d..b1ed4ce 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 - 2 * titleX, description.getTitleColor());
+ ScreenDrawing.drawString(context, getTitle().asOrderedText(), description.getTitleAlignment(), titleX, titleY, width - 2 * 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..4064a04 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,105 +27,105 @@ public class ScreenDrawing {
/**
* Draws a textured rectangle.
*
- * @param matrices the rendering matrix stack
- * @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
- * @param height the height of the box on-screen
- * @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
+ * @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
+ * @param height the height of the box on-screen
+ * @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 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
- * @param height the height of the box on-screen
- * @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
- * @param opacity opacity of the drawn texture. (0f is fully opaque and 1f is fully visible)
+ * @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
+ * @param height the height of the box on-screen
+ * @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
+ * @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 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
- * @param height the height of the box on-screen
- * @param texture the Identifier for the texture
- * @param u1 the left edge of the texture
- * @param v1 the top edge of the texture
- * @param u2 the right edge of the texture
- * @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
+ * @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
+ * @param height the height of the box on-screen
+ * @param texture the Identifier for the texture
+ * @param u1 the left edge of the texture
+ * @param v1 the top edge of the texture
+ * @param u2 the right edge of the texture
+ * @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 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
- * @param height the height of the box on-screen
- * @param texture 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
+ * @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
+ * @param height the height of the box on-screen
+ * @param texture 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
* @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 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
- * @param height the height of the box on-screen
- * @param texture 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
- * @param opacity opacity of the drawn texture. (0f is fully opaque and 1f is fully visible)
+ * @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
+ * @param height the height of the box on-screen
+ * @param texture 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
+ * @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 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
- * @param height the height of the box on-screen
- * @param texture the Identifier for the texture
- * @param u1 the left edge of the texture
- * @param v1 the top edge of the texture
- * @param u2 the right edge of the texture
- * @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
- * @param opacity opacity of the drawn texture. (0f is fully opaque and 1f is fully visible)
+ * @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
+ * @param height the height of the box on-screen
+ * @param texture the Identifier for the texture
+ * @param u1 the left edge of the texture
+ * @param v1 the top edge of the texture
+ * @param u2 the right edge of the texture
+ * @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
+ * @param opacity opacity of the drawn texture. (0f is fully opaque and 1f is fully visible)
* @since 2.0.0