Skip to content

Commit 7ca580a

Browse files
committed
add Hide Tooltip option to Item Protection
1 parent cc5d2ab commit 7ca580a

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/main/java/nofrills/features/general/ItemProtection.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ public class ItemProtection {
3939
public static final SettingBool protectRarityUpgraded = new SettingBool(false, "protectRarityUpgraded", instance);
4040
public static final SettingBool protectValue = new SettingBool(false, "protectValue", instance);
4141
public static final SettingDouble protectValueMin = new SettingDouble(5000000.0, "protectValueMin", instance);
42+
public static final SettingBool hideTooltip = new SettingBool(false, "hideTooltip", instance);
4243

4344
private static boolean isSellGUI = false;
4445
private static boolean isSalvageGUI = false;
4546
private static boolean overrideActive = false;
47+
private static boolean revealingTooltip = false;
4648

4749
public static ProtectType getProtectType(ItemStack stack) {
4850
if (overrideActive || stack.isEmpty()) return ProtectType.None;
@@ -144,6 +146,9 @@ private static void addSkyblockID(ItemStack stack) {
144146
@EventHandler
145147
private static void onKey(InputEvent event) {
146148
if (instance.isActive() && (mc.currentScreen instanceof InventoryScreen || mc.currentScreen instanceof GenericContainerScreen)) {
149+
if (hideTooltip.value() && event.key == GLFW.GLFW_KEY_LEFT_SHIFT) {
150+
revealingTooltip = event.action != GLFW.GLFW_RELEASE;
151+
}
147152
if (overrideKey.isKey(event.key)) {
148153
overrideActive = event.action != GLFW.GLFW_RELEASE;
149154
event.cancel();
@@ -167,6 +172,9 @@ private static void onKey(InputEvent event) {
167172
@EventHandler
168173
private static void onTooltip(TooltipRenderEvent event) {
169174
if (instance.isActive() && !event.stack.isEmpty() && event.customData != null) {
175+
if (hideTooltip.value() && !revealingTooltip) {
176+
return;
177+
}
170178
ProtectType type = getProtectType(event.stack);
171179
if (!type.equals(ProtectType.None)) {
172180
MutableText line = Text.literal(Utils.format("§aItem Protected §7({})", type.name()));
@@ -221,6 +229,7 @@ private static void onScreen(ScreenOpenEvent event) {
221229
private static void onScreenClose(ScreenCloseEvent event) {
222230
if (instance.isActive()) {
223231
overrideActive = false;
232+
revealingTooltip = false;
224233
}
225234
}
226235

src/main/java/nofrills/hud/clickgui/ClickGui.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ protected void build(FlowLayout root) {
229229
new Settings.Toggle("Protect Starred", ItemProtection.protectStarred, "Protects any item with Dungeon stars on it."),
230230
new Settings.Toggle("Protect Rarity Upgraded", ItemProtection.protectRarityUpgraded, "Protects any item that is Recombobulated."),
231231
new Settings.Toggle("Protect By Value", ItemProtection.protectValue, "Protects any item that has a high enough NPC/Auction/Bazaar value."),
232-
new Settings.DoubleInput("Minimum Value", ItemProtection.protectValueMin, "The minimum item value for an item to be protected by value.")
232+
new Settings.DoubleInput("Minimum Value", ItemProtection.protectValueMin, "The minimum item value for an item to be protected by value."),
233+
new Settings.Toggle("Hide Tooltip", ItemProtection.hideTooltip, "Hides the tooltip line about items being protected. Hold Left Shift to reveal the line.")
233234
))),
234235
new Module("Info Tooltips", InfoTooltips.instance, "Adds various information about an item to its tooltip.", new Settings(List.of(
235236
new Settings.Toggle("Dungeon Quality", InfoTooltips.dungeonQuality, "Displays the quality and the floor tier on applicable dungeon items."),

0 commit comments

Comments
 (0)