From 533233843d8a05a95b152019344974b07175d8ba Mon Sep 17 00:00:00 2001 From: Juuxel <6596629+Juuxel@users.noreply.github.com> Date: Wed, 1 Jul 2020 11:42:57 +0300 Subject: Fix player inventories not having slot peers --- src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java | 7 +++++++ .../java/io/github/cottonmc/cotton/gui/widget/WPlayerInvPanel.java | 2 +- src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java index 259e93d..10725ee 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java @@ -175,6 +175,13 @@ public abstract class WPanel extends WWidget { return this; } + /** + * {@inheritDoc} + * + *
Subclasses should call {@code super.validate(c)} to ensure that children are validated. + * + * @param c the host GUI description + */ @Override public void validate(GuiDescription c) { super.validate(c); diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WPlayerInvPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WPlayerInvPanel.java index 91fa547..3879e1f 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WPlayerInvPanel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WPlayerInvPanel.java @@ -82,9 +82,9 @@ public class WPlayerInvPanel extends WPlainPanel { @Override public void validate(GuiDescription c) { + super.validate(c); if (c != null && label instanceof WLabel) { ((WLabel) label).setColor(c.getTitleColor()); } } } - 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 824a5b2..e615c53 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 @@ -362,6 +362,8 @@ public class WWidget { /** * Creates component peers, lays out children, and initializes animation data for this Widget and all its children. * The host container must clear any heavyweight peers from its records before this method is called. + * + * @param host the host GUI description */ public void validate(GuiDescription host) { this.host = host; -- cgit