From 1aba27451ce4b95dc7a832938998c9d1581eee97 Mon Sep 17 00:00:00 2001 From: Juuz <6596629+Juuxel@users.noreply.github.com> Date: Fri, 4 Jun 2021 16:16:42 +0300 Subject: Validate root panels automatically --- .../java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java | 4 ++-- .../io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java index df5108c..d6928ee 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java @@ -37,13 +37,13 @@ public class CottonClientScreen extends Screen implements CottonScreenImpl { protected WWidget lastResponder = null; public CottonClientScreen(GuiDescription description) { - super(new LiteralText("")); - this.description = description; + this(new LiteralText(""), description); } public CottonClientScreen(Text title, GuiDescription description) { super(title); this.description = description; + description.getRootPanel().validate(description); } public GuiDescription getDescription() { diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java index 9c344cd..dba1add 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java @@ -50,6 +50,7 @@ public class CottonInventoryScreen extends Handl height = 18*9; this.backgroundWidth = 18*9; this.backgroundHeight = 18*9; + description.getRootPanel().validate(description); } /* -- cgit