aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java5
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java8
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java10
3 files changed, 17 insertions, 6 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java
index 39a7a26..9cd83fd 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java
@@ -7,7 +7,6 @@ import net.minecraft.client.util.math.MatrixStack;
import io.github.cottonmc.cotton.gui.GuiDescription;
import io.github.cottonmc.cotton.gui.widget.data.Axis;
import io.github.cottonmc.cotton.gui.widget.data.InputResult;
-import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.HashMap;
@@ -124,9 +123,9 @@ public class WListPanel<D, W extends WWidget> extends WClippedPanel {
}
@Override
- public void setHost(@Nullable GuiDescription host) {
+ public void setHost(GuiDescription host) {
super.setHost(host);
- if (host != null) setRequiredHosts(host);
+ setRequiredHosts(host);
}
private void setRequiredHosts(GuiDescription host) {
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 d91950e..b6d0169 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
@@ -130,6 +130,14 @@ public abstract class WPanel extends WWidget {
}
}
+ @Override
+ public void setHost(GuiDescription host) {
+ super.setHost(host);
+ for (WWidget child : children) {
+ child.setHost(host);
+ }
+ }
+
@Environment(EnvType.CLIENT)
@Override
public void paint(MatrixStack matrices, int x, int y, int mouseX, int mouseY) {
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 9636e8b..eb69e50 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
@@ -386,14 +386,18 @@ public class WWidget {
}
/**
- * Sets the host of this widget without creating peers.
+ * Sets the host of this widget and all its children without creating peers.
*
* @param host the new host
* @see #host
* @since 2.1.0
*/
- public void setHost(@Nullable GuiDescription host) {
- this.host = host;
+ public void setHost(GuiDescription host) {
+ if (host != null) {
+ this.host = host;
+ } else {
+ LOGGER.warn("Setting null host for {}", this);
+ }
}
/**