diff options
Diffstat (limited to 'src/main')
8 files changed, 18 insertions, 2 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java index 719f88e..016eceb 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java @@ -73,6 +73,7 @@ public class WButton extends WWidget { return true; } + @Environment(EnvType.CLIENT) @Override public void paint(MatrixStack matrices, int x, int y, int mouseX, int mouseY) { boolean hovered = (mouseX>=0 && mouseY>=0 && mouseX<getWidth() && mouseY<getHeight()); diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WClippedPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WClippedPanel.java index 531ae85..9a93c7a 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WClippedPanel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WClippedPanel.java @@ -1,12 +1,15 @@ package io.github.cottonmc.cotton.gui.widget; import io.github.cottonmc.cotton.gui.client.Scissors; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; import net.minecraft.client.util.math.MatrixStack; /** * A panel that is clipped to only render widgets inside its bounds. */ public class WClippedPanel extends WPanel { + @Environment(EnvType.CLIENT) @Override public void paint(MatrixStack matrices, int x, int y, int mouseX, int mouseY) { if (getBackgroundPainter()!=null) getBackgroundPainter().paintBackground(x, y, this); diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WDynamicLabel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WDynamicLabel.java index a3adac9..0412b83 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WDynamicLabel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WDynamicLabel.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.client.util.math.MatrixStack; import io.github.cottonmc.cotton.gui.client.LibGuiClient; @@ -34,6 +36,7 @@ public class WDynamicLabel extends WWidget { this(text, DEFAULT_TEXT_COLOR); } + @Environment(EnvType.CLIENT) @Override public void paint(MatrixStack matrices, int x, int y, int mouseX, int mouseY) { String tr = text.get(); diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java index fddc09a..7cc76e9 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java @@ -79,6 +79,7 @@ public class WLabel extends WWidget { this(text, DEFAULT_TEXT_COLOR); } + @Environment(EnvType.CLIENT) @Override public void paint(MatrixStack matrices, int x, int y, int mouseX, int mouseY) { MinecraftClient mc = MinecraftClient.getInstance(); 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 bcfbf2b..2ddc6f1 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 @@ -1,5 +1,7 @@ package io.github.cottonmc.cotton.gui.widget; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; import net.minecraft.client.util.math.MatrixStack; import io.github.cottonmc.cotton.gui.widget.data.Axis; @@ -69,7 +71,8 @@ public class WListPanel<D, W extends WWidget> extends WClippedPanel { scrollBar.setMaxValue(data.size()); scrollBar.setParent(this); } - + + @Environment(EnvType.CLIENT) @Override public void paint(MatrixStack matrices, int x, int y, int mouseX, int mouseY) { if (scrollBar.getValue()!=lastScroll) { diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java index 3ed7e2d..233a90a 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java @@ -32,6 +32,7 @@ public class WScrollBar extends WWidget { this.axis = axis; } + @Environment(EnvType.CLIENT) @Override public void paint(MatrixStack matrices, int x, int y, int mouseX, int mouseY) { if (LibGuiClient.config.darkMode) { diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollPanel.java index b4addcc..e66d359 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollPanel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollPanel.java @@ -1,5 +1,7 @@ package io.github.cottonmc.cotton.gui.widget; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; import net.fabricmc.fabric.api.util.TriState; import net.minecraft.client.util.math.MatrixStack; @@ -86,6 +88,7 @@ public class WScrollPanel extends WClippedPanel { return this; } + @Environment(EnvType.CLIENT) @Override public void paint(MatrixStack matrices, int x, int y, int mouseX, int mouseY) { if (verticalScrollBar.getValue() != lastVerticalScroll || horizontalScrollBar.getValue() != lastHorizontalScroll) { diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java index 191c609..93ebdcb 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java @@ -513,7 +513,8 @@ public class WTextField extends WWidget { @Override public void onFocusGained() { } - + + @Environment(EnvType.CLIENT) @Override public void paint(MatrixStack matrices, int x, int y, int mouseX, int mouseY) { |