diff options
Diffstat (limited to 'src')
4 files changed, 11 insertions, 7 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 af09893..09b87fd 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 @@ -185,8 +185,9 @@ public class WBar extends WWidget { } @Override - public void createPeers(GuiDescription c) { - if (properties==null) properties = c.getPropertyDelegate(); + public void validate(GuiDescription host) { + super.validate(host); + if (properties==null) properties = host.getPropertyDelegate(); } /** diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java index 75c77cd..2aee0e7 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java @@ -191,8 +191,8 @@ public class WItemSlot extends WWidget { } @Override - public void createPeers(GuiDescription c) { - super.createPeers(c); + public void validate(GuiDescription host) { + super.validate(host); peers.clear(); int index = startIndex; @@ -204,7 +204,7 @@ public class WItemSlot extends WWidget { slot.setTakingAllowed(takingAllowed); slot.setFilter(filter); peers.add(slot); - c.addSlotPeer(slot); + host.addSlotPeer(slot); index++; } } 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 d657a01..259e93d 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 @@ -27,6 +27,7 @@ public abstract class WPanel extends WWidget { @Environment(EnvType.CLIENT) private BackgroundPainter backgroundPainter = null; + @SuppressWarnings("deprecation") @Override public void createPeers(GuiDescription c) { super.createPeers(c); @@ -176,6 +177,7 @@ public abstract class WPanel extends WWidget { @Override public void validate(GuiDescription c) { + super.validate(c); layout(); for (WWidget child : children) { child.validate(c); 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 7c1245a..8df8e14 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 @@ -310,9 +310,10 @@ public class WWidget { /** * Creates "heavyweight" component peers * @param c the top-level Container that will hold the peers + * @deprecated All widget peers should be added in {@link #validate(GuiDescription)}. */ + @Deprecated public void createPeers(GuiDescription c) { - host=c; } /** @@ -363,7 +364,7 @@ public class WWidget { * The host container must clear any heavyweight peers from its records before this method is called. */ public void validate(GuiDescription host) { - //valid = true; + this.host = host; } /** |