From 084780db053f12c8908847d02bf24b5fb23c9581 Mon Sep 17 00:00:00 2001 From: Juuxel <6596629+Juuxel@users.noreply.github.com> Date: Mon, 13 Apr 2020 21:28:20 +0300 Subject: Add Environment annotations to WWidget.tick overrides --- .../java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java | 3 +++ src/main/java/io/github/cottonmc/cotton/gui/widget/WItem.java | 1 + src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java | 6 +++++- 3 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src/main/java/io') diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java index a086b3a..7d19288 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java @@ -1,5 +1,7 @@ package io.github.cottonmc.cotton.gui.widget; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; import net.minecraft.util.math.MathHelper; import org.lwjgl.glfw.GLFW; @@ -152,6 +154,7 @@ public abstract class WAbstractSlider extends WWidget { } } + @Environment(EnvType.CLIENT) @Override public void tick() { if (draggingFinishedFromScrollingTimer > 0) { diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WItem.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WItem.java index be516c7..6302125 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WItem.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WItem.java @@ -41,6 +41,7 @@ public class WItem extends WWidget { return true; } + @Environment(EnvType.CLIENT) @Override public void tick() { if (ticks++ >= duration) { 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 1233d7d..706a71b 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 @@ -169,7 +169,11 @@ public abstract class WPanel extends WWidget { child.paintForeground(x + child.getX(), y + child.getY(), mouseX, mouseY); } } - + + /** + * Ticks all children of this panel. + */ + @Environment(EnvType.CLIENT) @Override public void tick() { for(WWidget child : children) child.tick(); -- cgit