diff options
Diffstat (limited to 'src/main/java/gregtech/client/GT_TooltipHandler.java')
-rw-r--r-- | src/main/java/gregtech/client/GT_TooltipHandler.java | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/main/java/gregtech/client/GT_TooltipHandler.java b/src/main/java/gregtech/client/GT_TooltipHandler.java new file mode 100644 index 0000000000..f91706ad74 --- /dev/null +++ b/src/main/java/gregtech/client/GT_TooltipHandler.java @@ -0,0 +1,83 @@ +package gregtech.client; + +import static com.gtnewhorizon.gtnhlib.util.AnimatedTooltipHandler.*; + +public class GT_TooltipHandler { + + /* + * What you can do: + * - Add simple, unformatted text. + * - Add formatted text. + * Note: you can chain formatting codes but the color must be used first: + * e.g. BLACK + ITALIC will create black, italic text but ITALIC + BLACK will only create black text. + * - add animated text + * - chain multiple static and/or animated text together using chain() + * (Although chaining only static text together is pointless, text() is already able to do that) + * - add multiple lines by using NEW_LINE (either as String or as Supplier<String>) + * Note: formatting only applies for one line + * Note: having a NEW_LINE in animated text results in "skipping" of one formatting since NEW_LINE + * counts as character but is not displayed + * + * Note: adding a tooltip to an item multiple times also creates multiple lines (in the same order they were added) + * + * What you cannot do: + * - add a tooltip depending on NBT, tooltips are only mapped to name and meta + * + * This method is executed on postInit + */ + public static void init() { + + // Tooltip tiers for ALL items given the appropriate tier oredict tag. + addOredictTooltip("ULV", text(WHITE + "ULV-Tier")); + addOredictTooltip("LV", text(GRAY + "LV-Tier")); + addOredictTooltip("MV", text(GOLD + "MV-Tier")); + addOredictTooltip("HV", text(YELLOW + "HV-Tier")); + addOredictTooltip("EV", text(DARK_GRAY + "EV-Tier")); + addOredictTooltip("IV", text(GREEN + "IV-Tier")); + addOredictTooltip("LuV", text(LIGHT_PURPLE + "LuV-Tier")); + addOredictTooltip("ZPM", text(AQUA + "ZPM-Tier")); + addOredictTooltip("UV", text(DARK_GREEN + "UV-Tier")); + addOredictTooltip("UHV", text(DARK_RED + "UHV-Tier")); + addOredictTooltip("UEV", text(DARK_PURPLE + "UEV-Tier")); + addOredictTooltip("UIV", text(DARK_BLUE + BOLD + "UIV-Tier")); + addOredictTooltip("UMV", text(RED + BOLD + UNDERLINE + "UMV-Tier")); + addOredictTooltip( + "UXV", animatedText("UXV-Tier", 1, 100, DARK_PURPLE + BOLD + UNDERLINE, DARK_RED + UNDERLINE + BOLD)); + addOredictTooltip( + "MAX", + chain( + animatedText( + "X", + 1, + 100, + LIGHT_PURPLE + BOLD + OBFUSCATED + UNDERLINE, + RED + BOLD + OBFUSCATED + UNDERLINE, + GOLD + OBFUSCATED + BOLD + UNDERLINE, + YELLOW + OBFUSCATED + BOLD + UNDERLINE, + GREEN + OBFUSCATED + BOLD + UNDERLINE, + AQUA + OBFUSCATED + BOLD + UNDERLINE, + BLUE + OBFUSCATED + BOLD + UNDERLINE), + animatedText( + "MAX-Tier", + 1, + 100, + RED + BOLD + UNDERLINE, + GOLD + BOLD + UNDERLINE, + YELLOW + BOLD + UNDERLINE, + GREEN + BOLD + UNDERLINE, + AQUA + BOLD + UNDERLINE, + BLUE + BOLD + UNDERLINE, + LIGHT_PURPLE + BOLD + UNDERLINE), + animatedText( + "X", + 1, + 100, + GOLD + OBFUSCATED + BOLD + UNDERLINE, + YELLOW + OBFUSCATED + BOLD + UNDERLINE, + GREEN + OBFUSCATED + BOLD + UNDERLINE, + AQUA + OBFUSCATED + BOLD + UNDERLINE, + BLUE + OBFUSCATED + BOLD + UNDERLINE, + LIGHT_PURPLE + OBFUSCATED + BOLD + UNDERLINE, + RED + OBFUSCATED + BOLD + UNDERLINE))); + } +} |