aboutsummaryrefslogtreecommitdiff
path: root/src
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 /src
parent6851be1399c377d02f6fe52f667880578da9d7ef (diff)
downloadLibGui-baf993e6d3f9fe560eafa27718c33d8c2bedce10.tar.gz
LibGui-baf993e6d3f9fe560eafa27718c33d8c2bedce10.tar.bz2
LibGui-baf993e6d3f9fe560eafa27718c33d8c2bedce10.zip
Fix #130, bump version to 4.1.64.1.6
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java12
1 files changed, 2 insertions, 10 deletions
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!");
}
}