aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonHud.java15
1 files changed, 15 insertions, 0 deletions
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 8eb5f42..a9d1d9b 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
@@ -45,6 +45,21 @@ public enum CottonHud implements HudRenderCallback {
}
/**
+ * Adds a new widget to the HUD at the specified offsets and resizes it.
+ *
+ * @param widget the widget
+ * @param x the x offset
+ * @param y the y offset
+ * @param width the width of the widget
+ * @param height the heigh of the widget
+ * @see Positioner#of documentation about the offsets
+ */
+ public void add(WWidget widget, int x, int y, int width, int height) {
+ add(widget, Positioner.of(x, y));
+ widget.setSize(width, height);
+ }
+
+ /**
* Adds a new widget to the HUD with a custom positioner.
*
* @param widget the widget