aboutsummaryrefslogtreecommitdiff
path: root/GuiTest/src/main/java/io
diff options
context:
space:
mode:
Diffstat (limited to 'GuiTest/src/main/java/io')
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java3
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/client/WHudTest.java26
2 files changed, 29 insertions, 0 deletions
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java b/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java
index 5ef61c2..65efe75 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java
@@ -1,5 +1,6 @@
package io.github.cottonmc.test.client;
+import io.github.cottonmc.cotton.gui.client.CottonHud;
import io.github.cottonmc.cotton.gui.client.CottonInventoryScreen;
import io.github.cottonmc.test.LibGuiTest;
import io.github.cottonmc.test.TestDescription;
@@ -14,6 +15,8 @@ public class LibGuiTestClient implements ClientModInitializer {
LibGuiTest.GUI_SCREEN_HANDLER_TYPE,
(desc, inventory, title) -> new CottonInventoryScreen<>(desc, inventory.player, title)
);
+
+ CottonHud.INSTANCE.add(new WHudTest(), 10, -20, 10, 10);
}
}
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/client/WHudTest.java b/GuiTest/src/main/java/io/github/cottonmc/test/client/WHudTest.java
new file mode 100644
index 0000000..2cc1e4b
--- /dev/null
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/client/WHudTest.java
@@ -0,0 +1,26 @@
+package io.github.cottonmc.test.client;
+
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
+
+import net.minecraft.client.util.math.MatrixStack;
+
+import io.github.cottonmc.cotton.gui.client.ScreenDrawing;
+import io.github.cottonmc.cotton.gui.widget.WWidget;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+@Environment(EnvType.CLIENT)
+public class WHudTest extends WWidget {
+ private static final Logger LOGGER = LogManager.getLogger();
+
+ @Override
+ public void paint(MatrixStack matrices, int x, int y, int mouseX, int mouseY) {
+ ScreenDrawing.coloredRect(x, y, width, height, 0xFF_00FF00);
+ }
+
+ @Override
+ public void tick() {
+ LOGGER.debug("tick!");
+ }
+}