aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/LibGui.java20
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/LibGuiClient.java6
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java346
3 files changed, 371 insertions, 1 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/LibGui.java b/src/main/java/io/github/cottonmc/cotton/gui/client/LibGui.java
new file mode 100644
index 0000000..4be9c29
--- /dev/null
+++ b/src/main/java/io/github/cottonmc/cotton/gui/client/LibGui.java
@@ -0,0 +1,20 @@
+package io.github.cottonmc.cotton.gui.client;
+
+/**
+ * This class provides access to LibGui configuration and other global data.
+ *
+ * @since 3.4.0
+ */
+public final class LibGui {
+ private LibGui() {
+ }
+
+ /**
+ * Returns whether LibGui is running in dark mode and widgets should use dark theming.
+ *
+ * @return true if widgets should use dark theming, false otherwise
+ */
+ public static boolean isDarkMode() {
+ return LibGuiClient.config.darkMode;
+ }
+}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/LibGuiClient.java b/src/main/java/io/github/cottonmc/cotton/gui/client/LibGuiClient.java
index 80fa414..2c49933 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/client/LibGuiClient.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/client/LibGuiClient.java
@@ -13,11 +13,17 @@ import io.github.cottonmc.cotton.gui.impl.ScreenNetworkingImpl;
import io.github.cottonmc.jankson.JanksonFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.jetbrains.annotations.ApiStatus;
import java.io.File;
import java.io.FileOutputStream;
import java.nio.charset.StandardCharsets;
+/**
+ * @deprecated Replaced by {@link LibGui}.
+ */
+@Deprecated
+@ApiStatus.ScheduledForRemoval(inVersion = "4.0.0")
public class LibGuiClient implements ClientModInitializer {
public static final Logger logger = LogManager.getLogger();
public static final String MODID = "libgui";
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 f31a046..a9e3ec9 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
@@ -9,9 +9,11 @@ import net.minecraft.client.render.VertexFormats;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.OrderedText;
import net.minecraft.util.Identifier;
+import net.minecraft.util.math.Matrix4f;
import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment;
import io.github.cottonmc.cotton.gui.widget.data.Texture;
+import org.jetbrains.annotations.ApiStatus;
import org.lwjgl.opengl.GL11;
/**
@@ -29,7 +31,10 @@ public class ScreenDrawing {
* @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
+ * @deprecated Replaced by the overload taking a {@link MatrixStack}.
*/
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval(inVersion = "4.0.0")
public static void texturedRect(int x, int y, int width, int height, Identifier texture, int color) {
texturedRect(x, y, width, height, texture, 0, 0, 1, 1, color, 1.0f);
}
@@ -45,7 +50,10 @@ 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
* @param opacity opacity of the drawn texture. (0f is fully opaque and 1f is fully visible)
* @since 2.0.0
+ * @deprecated Replaced by the overload taking a {@link MatrixStack}.
*/
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval(inVersion = "4.0.0")
public static void texturedRect(int x, int y, int width, int height, Identifier texture, int color, float opacity) {
texturedRect(x, y, width, height, texture, 0, 0, 1, 1, color, opacity);
}
@@ -63,7 +71,10 @@ public class ScreenDrawing {
* @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
+ * @deprecated Replaced by the overload taking a {@link MatrixStack}.
*/
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval(inVersion = "4.0.0")
public static void texturedRect(int x, int y, int width, int height, Identifier texture, float u1, float v1, float u2, float v2, int color) {
texturedRect(x, y, width, height, texture, u1, v1, u2, v2, color, 1.0f);
}
@@ -78,7 +89,10 @@ public class ScreenDrawing {
* @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
+ * @deprecated Replaced by the overload taking a {@link MatrixStack}.
*/
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval(inVersion = "4.0.0")
public static void texturedRect(int x, int y, int width, int height, Texture texture, int color) {
texturedRect(x, y, width, height, texture, color, 1.0f);
}
@@ -94,7 +108,10 @@ 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
* @param opacity opacity of the drawn texture. (0f is fully opaque and 1f is fully visible)
* @since 3.0.0
+ * @deprecated Replaced by the overload taking a {@link MatrixStack}.
*/
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval(inVersion = "4.0.0")
public static void texturedRect(int x, int y, int width, int height, Texture texture, int color, float opacity) {
texturedRect(x, y, width, height, texture.image, texture.u1, texture.v1, texture.u2, texture.v2, color, opacity);
}
@@ -114,7 +131,10 @@ 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
* @param opacity opacity of the drawn texture. (0f is fully opaque and 1f is fully visible)
* @since 2.0.0
+ * @deprecated Replaced by the overload taking a {@link MatrixStack}.
*/
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval(inVersion = "4.0.0")
public static void texturedRect(int x, int y, int width, int height, Identifier texture, float u1, float v1, float u2, float v2, int color, float opacity) {
MinecraftClient.getInstance().getTextureManager().bindTexture(texture);
@@ -153,7 +173,10 @@ public class ScreenDrawing {
* @param textureX the x offset into the texture
* @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
+ * @deprecated Replaced by the overload taking a {@link MatrixStack}.
*/
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval(inVersion = "4.0.0")
public static void texturedGuiRect(int x, int y, int width, int height, Identifier texture, int textureX, int textureY, int color) {
float px = 1/256f;
texturedRect(x, y, width, height, texture, textureX*px, textureY*px, (textureX+width)*px, (textureY+height)*px, color);
@@ -170,14 +193,20 @@ public class ScreenDrawing {
* @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
+ * @deprecated Replaced by the overload taking a {@link MatrixStack}.
*/
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval(inVersion = "4.0.0")
public static void texturedGuiRect(int left, int top, int width, int height, Identifier texture, int color) {
texturedGuiRect(left, top, width, height, texture, 0, 0, color);
}
/**
* Draws an untextured rectangle of the specified RGB color.
+ * @deprecated Replaced by the overload taking a {@link MatrixStack}.
*/
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval(inVersion = "4.0.0")
public static void coloredRect(int left, int top, int width, int height, int color) {
if (width <= 0) width = 1;
if (height <= 0) height = 1;
@@ -201,6 +230,11 @@ public class ScreenDrawing {
RenderSystem.disableBlend();
}
+ /**
+ * @deprecated Replaced by {@link Scissors}.
+ */
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval(inVersion = "4.0.0")
public static void maskedRect(Identifier mask, Identifier texture, int left, int top, int width, int height) {
@@ -260,9 +294,12 @@ public class ScreenDrawing {
* @param y the Y position of the panel
* @param width the width of the panel
* @param height the height of the panel
+ * @deprecated Replaced by the overload taking a {@link MatrixStack}.
*/
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval(inVersion = "4.0.0")
public static void drawGuiPanel(int x, int y, int width, int height) {
- if (LibGuiClient.config.darkMode) drawGuiPanel(x, y, width, height, 0xFF0B0B0B, 0xFF2F2F2F, 0xFF414141, 0xFF000000);
+ if (LibGui.isDarkMode()) drawGuiPanel(x, y, width, height, 0xFF0B0B0B, 0xFF2F2F2F, 0xFF414141, 0xFF000000);
else drawGuiPanel(x, y, width, height, 0xFF555555, 0xFFC6C6C6, 0xFFFFFFFF, 0xFF000000);
}
@@ -274,7 +311,10 @@ public class ScreenDrawing {
* @param width the width of the panel
* @param height the height of the panel
* @param panelColor the panel ARGB color
+ * @deprecated Replaced by the overload taking a {@link MatrixStack}.
*/
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval(inVersion = "4.0.0")
public static void drawGuiPanel(int x, int y, int width, int height, int panelColor) {
int shadowColor = multiplyColor(panelColor, 0.50f);
int hilightColor = multiplyColor(panelColor, 1.25f);
@@ -293,7 +333,10 @@ public class ScreenDrawing {
* @param panel the center ARGB color
* @param hilight the top/left hilight ARGB color
* @param outline the outline ARGB color
+ * @deprecated Replaced by the overload taking a {@link MatrixStack}.
*/
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval(inVersion = "4.0.0")
public static void drawGuiPanel(int x, int y, int width, int height, int shadow, int panel, int hilight, int outline) {
coloredRect(x + 3, y + 3, width - 6, height - 6, panel); //Main panel area
@@ -318,14 +361,20 @@ public class ScreenDrawing {
/**
* Draws a default-sized recessed itemslot panel
+ * @deprecated Replaced by the overload taking a {@link MatrixStack}.
*/
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval(inVersion = "4.0.0")
public static void drawBeveledPanel(int x, int y) {
drawBeveledPanel(x, y, 18, 18, 0xFF373737, 0xFF8b8b8b, 0xFFFFFFFF);
}
/**
* Draws a default-color recessed itemslot panel of variable size
+ * @deprecated Replaced by the overload taking a {@link MatrixStack}.
*/
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval(inVersion = "4.0.0")
public static void drawBeveledPanel(int x, int y, int width, int height) {
drawBeveledPanel(x, y, width, height, 0xFF373737, 0xFF8b8b8b, 0xFFFFFFFF);
}
@@ -339,7 +388,10 @@ public class ScreenDrawing {
* @param topleft color of the top/left bevel
* @param panel color of the panel area
* @param bottomright color of the bottom/right bevel
+ * @deprecated Replaced by the overload taking a {@link MatrixStack}.
*/
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval(inVersion = "4.0.0")
public static void drawBeveledPanel(int x, int y, int width, int height, int topleft, int panel, int bottomright) {
coloredRect(x, y, width, height, panel); //Center panel
coloredRect(x, y, width - 1, 1, topleft); //Top shadow
@@ -349,6 +401,298 @@ 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
+ */
+ 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);
+ }
+
+ /**
+ * 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)
+ * @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);
+ }
+
+ /**
+ * 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
+ */
+ 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);
+ }
+
+ /**
+ * 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
+ * @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);
+ }
+
+ /**
+ * 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)
+ * @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);
+ }
+
+ /**
+ * 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)
+ * @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) {
+ MinecraftClient.getInstance().getTextureManager().bindTexture(texture);
+
+ //float scale = 0.00390625F;
+
+ if (width <= 0) width = 1;
+ if (height <= 0) height = 1;
+
+ float r = (color >> 16 & 255) / 255.0F;
+ float g = (color >> 8 & 255) / 255.0F;
+ float b = (color & 255) / 255.0F;
+ Tessellator tessellator = Tessellator.getInstance();
+ BufferBuilder buffer = tessellator.getBuffer();
+ Matrix4f model = matrices.peek().getModel();
+ RenderSystem.enableBlend();
+ //GlStateManager.disableTexture2D();
+ RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ZERO);
+ buffer.begin(GL11.GL_QUADS, VertexFormats.POSITION_COLOR_TEXTURE); //I thought GL_QUADS was deprecated but okay, sure.
+ buffer.vertex(model, x, y + height, 0).color(r, g, b, opacity).texture(u1, v2).next();
+ buffer.vertex(model, x + width, y + height, 0).color(r, g, b, opacity).texture(u2, v2).next();
+ buffer.vertex(model, x + width, y, 0).color(r, g, b, opacity).texture(u2, v1).next();
+ buffer.vertex(model, x, y, 0).color(r, g, b, opacity).texture(u1, v1).next();
+ tessellator.draw();
+ //GlStateManager.enableTexture2D();
+ RenderSystem.disableBlend();
+ }
+
+ /**
+ * Draws a textured rectangle with UV values based on the width and height.
+ *
+ * <p>If the texture is 256x256, this draws the texture at one pixel per texel.
+ *
+ * @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 textureX the x offset into the texture
+ * @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) {
+ float px = 1/256f;
+ texturedRect(matrices, x, y, width, height, texture, textureX*px, textureY*px, (textureX+width)*px, (textureY+height)*px, color);
+ }
+
+ /**
+ * Draws a textured rectangle with UV values based on the width and height.
+ *
+ * <p>If the texture is 256x256, this draws the texture at one pixel per texel.
+ *
+ * @param matrices the rendering matrix stack
+ * @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
+ * @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 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);
+ }
+
+ /**
+ * 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) {
+ if (width <= 0) width = 1;
+ if (height <= 0) height = 1;
+
+ float a = (color >> 24 & 255) / 255.0F;
+ float r = (color >> 16 & 255) / 255.0F;
+ float g = (color >> 8 & 255) / 255.0F;
+ float b = (color & 255) / 255.0F;
+ Tessellator tessellator = Tessellator.getInstance();
+ BufferBuilder buffer = tessellator.getBuffer();
+ Matrix4f model = matrices.peek().getModel();
+ RenderSystem.enableBlend();
+ RenderSystem.disableTexture();
+ RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ZERO);
+ buffer.begin(GL11.GL_QUADS, VertexFormats.POSITION_COLOR); //I thought GL_QUADS was deprecated but okay, sure.
+ buffer.vertex(model, left, top + height, 0).color(r, g, b, a).next();
+ buffer.vertex(model, left + width, top + height, 0).color(r, g, b, a).next();
+ buffer.vertex(model, left + width, top, 0).color(r, g, b, a).next();
+ buffer.vertex(model, left, top, 0).color(r, g, b, a).next();
+ tessellator.draw();
+ RenderSystem.enableTexture();
+ RenderSystem.disableBlend();
+ }
+
+ /**
+ * Draws a beveled, round rectangle that is substantially similar to default Minecraft UI panels.
+ *
+ * @param matrices the rendering matrix stack
+ * @param x the X position of the panel
+ * @param y the Y position of the panel
+ * @param width the width of the panel
+ * @param height the height of the panel
+ */
+ public static void drawGuiPanel(MatrixStack matrices, int x, int y, int width, int height) {
+ if (LibGui.isDarkMode()) drawGuiPanel(matrices, x, y, width, height, 0xFF0B0B0B, 0xFF2F2F2F, 0xFF414141, 0xFF000000);
+ else drawGuiPanel(matrices, x, y, width, height, 0xFF555555, 0xFFC6C6C6, 0xFFFFFFFF, 0xFF000000);
+ }
+
+ /**
+ * Draws a beveled, round, and colored rectangle that is substantially similar to default Minecraft UI panels.
+ *
+ * @param matrices the rendering matrix stack
+ * @param x the X position of the panel
+ * @param y the Y position of the panel
+ * @param width the width of the panel
+ * @param height the height of the panel
+ * @param panelColor the panel ARGB color
+ */
+ public static void drawGuiPanel(MatrixStack matrices, int x, int y, int width, int height, int panelColor) {
+ int shadowColor = multiplyColor(panelColor, 0.50f);
+ int hilightColor = multiplyColor(panelColor, 1.25f);
+
+ drawGuiPanel(matrices, x, y, width, height, shadowColor, panelColor, hilightColor, 0xFF000000);
+ }
+
+ /**
+ * Draws a beveled, round rectangle with custom edge colors that is substantially similar to default Minecraft UI panels.
+ *
+ * @param matrices the rendering matrix stack
+ * @param x the X position of the panel
+ * @param y the Y position of the panel
+ * @param width the width of the panel
+ * @param height the height of the panel
+ * @param shadow the bottom/right shadow ARGB color
+ * @param panel the center ARGB color
+ * @param hilight the top/left hilight ARGB color
+ * @param outline the outline ARGB color
+ */
+ public static void drawGuiPanel(MatrixStack matrices, int x, int y, int width, int height, int shadow, int panel, int hilight, int outline) {
+ coloredRect(matrices, x + 3, y + 3, width - 6, height - 6, panel); //Main panel area
+
+ coloredRect(matrices, x + 2, y + 1, width - 4, 2, hilight); //Top hilight
+ coloredRect(matrices, x + 2, y + height - 3, width - 4, 2, shadow); //Bottom shadow
+ coloredRect(matrices, x + 1, y + 2, 2, height - 4, hilight); //Left hilight
+ coloredRect(matrices, x + width - 3, y + 2, 2, height - 4, shadow); //Right shadow
+ coloredRect(matrices, x + width - 3, y + 2, 1, 1, panel); //Topright non-hilight/non-shadow transition pixel
+ coloredRect(matrices, x + 2, y + height - 3, 1, 1, panel); //Bottomleft non-hilight/non-shadow transition pixel
+ coloredRect(matrices, x + 3, y + 3, 1, 1, hilight); //Topleft round hilight pixel
+ coloredRect(matrices, x + width - 4, y + height - 4, 1, 1, shadow); //Bottomright round shadow pixel
+
+ coloredRect(matrices, x + 2, y, width - 4, 1, outline); //Top outline
+ coloredRect(matrices, x, y + 2, 1, height - 4, outline); //Left outline
+ coloredRect(matrices, x + width - 1, y + 2, 1, height - 4, outline); //Right outline
+ coloredRect(matrices, x + 2, y + height - 1, width - 4, 1, outline); //Bottom outline
+ coloredRect(matrices, x + 1, y + 1, 1, 1, outline); //Topleft round pixel
+ coloredRect(matrices, x + 1, y + height - 2, 1, 1, outline); //Bottomleft round pixel
+ coloredRect(matrices, x + width - 2, y + 1, 1, 1, outline); //Topright round pixel
+ coloredRect(matrices, x + width - 2, y + height - 2, 1, 1, outline); //Bottomright round pixel
+ }
+
+ /**
+ * Draws a default-sized recessed itemslot panel
+ */
+ public static void drawBeveledPanel(MatrixStack matrices, int x, int y) {
+ drawBeveledPanel(matrices, x, y, 18, 18, 0xFF373737, 0xFF8b8b8b, 0xFFFFFFFF);
+ }
+
+ /**
+ * Draws a default-color recessed itemslot panel of variable size
+ */
+ public static void drawBeveledPanel(MatrixStack matrices, int x, int y, int width, int height) {
+ drawBeveledPanel(matrices, x, y, width, height, 0xFF373737, 0xFF8b8b8b, 0xFFFFFFFF);
+ }
+
+ /**
+ * Draws a generalized-case beveled panel. Can be inset or outset depending on arguments.
+ *
+ * @param matrices the rendering matrix stack
+ * @param x x coordinate of the topleft corner
+ * @param y y coordinate of the topleft corner
+ * @param width width of the panel
+ * @param height height of the panel
+ * @param topleft color of the top/left bevel
+ * @param panel color of the panel area
+ * @param bottomright color of the bottom/right bevel
+ */
+ public static void drawBeveledPanel(MatrixStack matrices, int x, int y, int width, int height, int topleft, int panel, int bottomright) {
+ coloredRect(matrices, x, y, width, height, panel); //Center panel
+ coloredRect(matrices, x, y, width - 1, 1, topleft); //Top shadow
+ coloredRect(matrices, x, y + 1, 1, height - 2, topleft); //Left shadow
+ coloredRect(matrices, x + width - 1, y + 1, 1, height - 1, bottomright); //Right hilight
+ coloredRect(matrices, x + 1, y + height - 1, width - 1, 1, bottomright); //Bottom hilight
+ }
+
+ /**
* Draws a string with a custom alignment.
*
* @param matrices the rendering matrix stack