diff options
-rw-r--r-- | GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java | 3 | ||||
-rw-r--r-- | GuiTest/src/main/java/io/github/cottonmc/test/client/WHudTest.java | 26 | ||||
-rw-r--r-- | build.gradle | 1 |
3 files changed, 30 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!"); + } +} diff --git a/build.gradle b/build.gradle index c891191..3c45adc 100644 --- a/build.gradle +++ b/build.gradle @@ -32,6 +32,7 @@ dependencies { modImplementation "io.github.cottonmc:Jankson-Fabric:${project.jankson_version}" include "io.github.cottonmc:Jankson-Fabric:${project.jankson_version}" + // TODO: When updating to Loom 0.5, swap this for Jetbrains annotations compileOnly ("com.google.code.findbugs:jsr305:3.0.2") { transitive = false } modRuntime(modCompileOnly("io.github.prospector:modmenu:$project.modmenu_version") { |