aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorJuuxel <6596629+Juuxel@users.noreply.github.com>2020-01-26 02:08:13 +0200
committerJuuxel <6596629+Juuxel@users.noreply.github.com>2020-01-26 02:08:13 +0200
commitbdb2f5e734c3afe352830b74a8ab34102a4336a6 (patch)
tree99fb57c5fc35e29664cad7cf4c37716a8cc026d4 /src/main/java/io
parent2aa4eeb634140d2ece368d9337d91d631f2b0d62 (diff)
downloadLibGui-bdb2f5e734c3afe352830b74a8ab34102a4336a6.tar.gz
LibGui-bdb2f5e734c3afe352830b74a8ab34102a4336a6.tar.bz2
LibGui-bdb2f5e734c3afe352830b74a8ab34102a4336a6.zip
Add utility method for adding a HUD widget at a pos
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonHud.java12
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java4
2 files changed, 15 insertions, 1 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 255c8bd..8eb5f42 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
@@ -33,6 +33,18 @@ public enum CottonHud implements HudRenderCallback {
}
/**
+ * Adds a new widget to the HUD at the specified offsets.
+ *
+ * @param widget the widget
+ * @param x the x offset
+ * @param y the y offset
+ * @see Positioner#of documentation about the offsets
+ */
+ public void add(WWidget widget, int x, int y) {
+ add(widget, Positioner.of(x, y));
+ }
+
+ /**
* Adds a new widget to the HUD with a custom positioner.
*
* @param widget the widget
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java
index d3bb769..ac6271d 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java
@@ -169,9 +169,11 @@ public class WBar extends WWidget {
* {@link GuiDescription#getPropertyDelegate()} should be preferred over this if available.
*
* @param properties the properties
+ * @return this bar
*/
- public void setProperties(PropertyDelegate properties) {
+ public WBar setProperties(PropertyDelegate properties) {
this.properties = properties;
+ return this;
}
/**