diff options
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java | 4 | ||||
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java | 2 |
2 files changed, 4 insertions, 2 deletions
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 1b45a5a..60fb7a9 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 @@ -57,6 +57,7 @@ public class WBar extends WWidget { */ protected int maxValue; protected PropertyDelegate properties; + private boolean manuallySetProperties = false; protected final Direction direction; protected String tooltipLabel; protected Text tooltipTextComponent; @@ -197,7 +198,7 @@ public class WBar extends WWidget { @Override public void validate(GuiDescription host) { super.validate(host); - if (properties==null) properties = host.getPropertyDelegate(); + if (properties==null || !manuallySetProperties) properties = host.getPropertyDelegate(); } /** @@ -221,6 +222,7 @@ public class WBar extends WWidget { */ public WBar setProperties(PropertyDelegate properties) { this.properties = properties; + manuallySetProperties = properties != null; return this; } diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java index d94a4b9..1091201 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java @@ -370,7 +370,7 @@ public class WWidget { if (host != null) { this.host = host; } else { - LOGGER.warn("Validating {} with a null host", this); + LOGGER.warn("Validating {} with a null host", this); } } |