aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuuxel <6596629+Juuxel@users.noreply.github.com>2020-10-24 10:56:57 +0300
committerJuuxel <6596629+Juuxel@users.noreply.github.com>2020-10-24 10:56:57 +0300
commit7b5dc61066c75dc1a4531f11b681fc51550e0dc1 (patch)
treefb29876cd52f9a7950bad2a1b919f932861883a7
parent51fbf5203d8ee7c22837dd72b84520c913a9c5bf (diff)
downloadLibGui-7b5dc61066c75dc1a4531f11b681fc51550e0dc1.tar.gz
LibGui-7b5dc61066c75dc1a4531f11b681fc51550e0dc1.tar.bz2
LibGui-7b5dc61066c75dc1a4531f11b681fc51550e0dc1.zip
Fix HUD widgets not ticking
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonHud.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonHud.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonHud.java
index 9549b99..79111d2 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonHud.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonHud.java
@@ -2,6 +2,7 @@ package io.github.cottonmc.cotton.gui.client;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
+import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.Window;
@@ -19,10 +20,15 @@ import java.util.Set;
*/
@Environment(EnvType.CLIENT)
public enum CottonHud implements HudRenderCallback {
- INSTANCE;
+ INSTANCE; // TODO (4.0): Migrate from singleton to static methods
static {
HudRenderCallback.EVENT.register(INSTANCE);
+ ClientTickEvents.END_CLIENT_TICK.register(client -> {
+ for (WWidget widget : INSTANCE.widgets) {
+ widget.tick();
+ }
+ });
}
private final Set<WWidget> widgets = new HashSet<>();