Skip to content

Commit

Permalink
Fix #130, bump version to 4.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Juuxel committed Aug 10, 2021
1 parent 6851be1 commit baf993e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
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;

Expand All @@ -23,6 +25,7 @@ public void onInitializeClient() {
);

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")
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,12 @@
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() {}

/**
Expand Down Expand Up @@ -494,7 +490,7 @@ public static void drawString(MatrixStack matrices, OrderedText text, int x, int
/**
* 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
Expand All @@ -504,12 +500,8 @@ public static void drawString(MatrixStack matrices, OrderedText text, int x, int
* @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!");
}
}

Expand Down

0 comments on commit baf993e

Please sign in to comment.