aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/util
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-04-27 10:15:43 +0200
committerGitHub <noreply@github.com>2024-04-27 10:15:43 +0200
commitcde33a4c83a2f2d781ff8bb740b7166691c04600 (patch)
tree936882c427187a469d63b4f5142549054314f432 /src/main/java/io/github/moulberry/notenoughupdates/util
parent18ea34b92d6106afda3b662256a2dc36dd4d8ec0 (diff)
downloadnotenoughupdates-cde33a4c83a2f2d781ff8bb740b7166691c04600.tar.gz
notenoughupdates-cde33a4c83a2f2d781ff8bb740b7166691c04600.tar.bz2
notenoughupdates-cde33a4c83a2f2d781ff8bb740b7166691c04600.zip
Add hotm upgrade TODOs/warning (#1090)
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/TabListUtils.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java24
2 files changed, 22 insertions, 3 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/TabListUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/TabListUtils.java
index f36db034..f7357343 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/TabListUtils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/TabListUtils.java
@@ -72,6 +72,7 @@ public class TabListUtils {
new TabListChangeEvent(tabList, tabListLastTick).post();
}
+ @Deprecated
public static List<String> getTabList() {
return tabList;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
index fee8c594..f13462bc 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
@@ -67,6 +67,7 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.fml.common.Loader;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.lwjgl.BufferUtils;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -1241,7 +1242,7 @@ public class Utils {
var width = fr.getStringWidth(str);
float scale = ((float) availableSpace) / width;
GlStateManager.scale(scale, scale, 1f);
- fr.drawString(str, -width / 2F, 0, colour, shadow);
+ fr.drawString(str, -width / 2F, 0, colour, shadow);
GlStateManager.popMatrix();
}
@@ -2342,10 +2343,27 @@ public class Utils {
return username;
}
- public static void addChatMessage(String message) {
+ public static void addChatMessage(@NotNull String message) {
+ addChatMessage(new ChatComponentText(message));
+ }
+
+ public static void addClickableChatMessage(
+ @NotNull String message,
+ @NotNull String command,
+ @Nullable String hoverText
+ ) {
+ if (hoverText == null)
+ hoverText = "§eClick to run §a" + command;
+ addChatMessage(new ChatComponentText(message)
+ .setChatStyle(new ChatStyle()
+ .setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command))
+ .setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(hoverText)))));
+ }
+
+ public static void addChatMessage(@NotNull IChatComponent message) {
EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
if (thePlayer != null) {
- thePlayer.addChatMessage(new ChatComponentText(message));
+ thePlayer.addChatMessage(message);
} else {
System.out.println(message);
}