aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuuz <6596629+Juuxel@users.noreply.github.com>2021-08-10 11:06:12 +0300
committerJuuz <6596629+Juuxel@users.noreply.github.com>2021-08-10 11:06:12 +0300
commitbaf993e6d3f9fe560eafa27718c33d8c2bedce10 (patch)
tree9a0d4794151656c49fbcbc95cc60d849187da984
parent6851be1399c377d02f6fe52f667880578da9d7ef (diff)
downloadLibGui-baf993e6d3f9fe560eafa27718c33d8c2bedce10.tar.gz
LibGui-baf993e6d3f9fe560eafa27718c33d8c2bedce10.tar.bz2
LibGui-baf993e6d3f9fe560eafa27718c33d8c2bedce10.zip
Fix #130, bump version to 4.1.64.1.6
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java3
-rw-r--r--gradle.properties2
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java12
3 files changed, 6 insertions, 11 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 02b1452..8d6cb18 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
@@ -3,11 +3,13 @@ package io.github.cottonmc.test.client;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.command.v1.ClientCommandManager;
import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry;
+import net.minecraft.text.LiteralText;
import io.github.cottonmc.cotton.gui.client.CottonClientScreen;
import io.github.cottonmc.cotton.gui.client.CottonHud;
import io.github.cottonmc.cotton.gui.client.CottonInventoryScreen;
import io.github.cottonmc.cotton.gui.impl.modmenu.ConfigGui;
+import io.github.cottonmc.cotton.gui.widget.WLabel;
import io.github.cottonmc.test.LibGuiTest;
import io.github.cottonmc.test.TestDescription;
@@ -23,6 +25,7 @@ public class LibGuiTestClient implements ClientModInitializer {
);
CottonHud.add(new WHudTest(), 10, -20, 10, 10);
+ CottonHud.add(new WLabel(new LiteralText("Test label")), 10, -30, 10, 10);
ClientCommandManager.DISPATCHER.register(
literal("libgui")
diff --git a/gradle.properties b/gradle.properties
index d8992a9..b25dc91 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.11.6
# Mod Properties
- mod_version = 4.1.5
+ mod_version = 4.1.6
maven_group = io.github.cottonmc
archives_base_name = LibGui
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java b/src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java
index 0035d93..99a6d00 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java
@@ -18,16 +18,12 @@ import net.minecraft.util.math.Matrix4f;
import io.github.cottonmc.cotton.gui.impl.client.CottonScreenImpl;
import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment;
import io.github.cottonmc.cotton.gui.widget.data.Texture;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.Nullable;
/**
* {@code ScreenDrawing} contains utility methods for drawing contents on a screen.
*/
public class ScreenDrawing {
- private static final Logger LOGGER = LogManager.getLogger();
-
private ScreenDrawing() {}
/**
@@ -494,7 +490,7 @@ public class ScreenDrawing {
/**
* Draws the text hover effects for a text style.
*
- * <p>This method should only be called from a widget in a screen.
+ * <p>This method has no effect when the caller is not in a LibGui screen.
* For example, there will be nothing drawn in HUDs.
*
* @param matrices the rendering matrix stack
@@ -504,12 +500,8 @@ public class ScreenDrawing {
* @since 4.0.0
*/
public static void drawTextHover(MatrixStack matrices, @Nullable Style textStyle, int x, int y) {
- CottonScreenImpl screen = (CottonScreenImpl) MinecraftClient.getInstance().currentScreen;
-
- if (screen != null) {
+ if (MinecraftClient.getInstance().currentScreen instanceof CottonScreenImpl screen) {
screen.renderTextHover(matrices, textStyle, x, y);
- } else {
- LOGGER.error("Rendering text hover effects outside of a screen!");
}
}