aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuuz <6596629+Juuxel@users.noreply.github.com>2023-11-18 21:37:25 +0200
committerJuuz <6596629+Juuxel@users.noreply.github.com>2023-11-18 21:37:25 +0200
commit3993b1a96704f9241b1bfceb03f9575c3c503b49 (patch)
treeafd4f3f62c8cba51ebcbae1843dc626f82df35d8
parent13996a09b090eceb7e5a3276b1603f0459a9584e (diff)
downloadLibGui-3993b1a96704f9241b1bfceb03f9575c3c503b49.tar.gz
LibGui-3993b1a96704f9241b1bfceb03f9575c3c503b49.tar.bz2
LibGui-3993b1a96704f9241b1bfceb03f9575c3c503b49.zip
WListPanel: Fix addPainters not being called on all children
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/impl/Proxy.java10
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/impl/client/ClientProxy.java11
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/impl/client/LibGuiClient.java2
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java7
4 files changed, 30 insertions, 0 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/Proxy.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/Proxy.java
new file mode 100644
index 0000000..6e5ebf2
--- /dev/null
+++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/Proxy.java
@@ -0,0 +1,10 @@
+package io.github.cottonmc.cotton.gui.impl;
+
+import io.github.cottonmc.cotton.gui.widget.WWidget;
+
+public class Proxy {
+ public static Proxy proxy = new Proxy();
+
+ public void addPainters(WWidget widget) {
+ }
+}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/client/ClientProxy.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/client/ClientProxy.java
new file mode 100644
index 0000000..bba97f6
--- /dev/null
+++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/client/ClientProxy.java
@@ -0,0 +1,11 @@
+package io.github.cottonmc.cotton.gui.impl.client;
+
+import io.github.cottonmc.cotton.gui.impl.Proxy;
+import io.github.cottonmc.cotton.gui.widget.WWidget;
+
+public final class ClientProxy extends Proxy {
+ @Override
+ public void addPainters(WWidget widget) {
+ widget.addPainters();
+ }
+}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/client/LibGuiClient.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/client/LibGuiClient.java
index 526fe96..d6f8f4f 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/impl/client/LibGuiClient.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/client/LibGuiClient.java
@@ -7,6 +7,7 @@ import net.fabricmc.loader.api.FabricLoader;
import blue.endless.jankson.Jankson;
import blue.endless.jankson.JsonElement;
import blue.endless.jankson.JsonObject;
+import io.github.cottonmc.cotton.gui.impl.Proxy;
import io.github.cottonmc.cotton.gui.impl.ScreenNetworkingImpl;
import io.github.cottonmc.jankson.JanksonFactory;
import org.apache.logging.log4j.LogManager;
@@ -32,6 +33,7 @@ public class LibGuiClient implements ClientModInitializer {
});
LibGuiShaders.register();
+ Proxy.proxy = new ClientProxy();
}
public static LibGuiConfig loadConfig() {
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 5a4c35b..675298e 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
@@ -5,6 +5,7 @@ import net.fabricmc.api.Environment;
import net.minecraft.client.gui.DrawContext;
import io.github.cottonmc.cotton.gui.GuiDescription;
+import io.github.cottonmc.cotton.gui.impl.Proxy;
import io.github.cottonmc.cotton.gui.widget.data.Axis;
import io.github.cottonmc.cotton.gui.widget.data.InputResult;
import io.github.cottonmc.cotton.gui.widget.data.Insets;
@@ -112,6 +113,7 @@ public class WListPanel<D, W extends WWidget> extends WClippedPanel {
} else {
requiresHost.add(child);
}
+ Proxy.proxy.addPainters(child);
return child;
}
@@ -127,6 +129,11 @@ public class WListPanel<D, W extends WWidget> extends WClippedPanel {
setRequiredHosts(host);
}
+ @Override
+ public void addPainters() {
+ // This is handled separately for our children.
+ }
+
private void setRequiredHosts(GuiDescription host) {
for (W widget : requiresHost) {
widget.setHost(host);