diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-26 11:06:28 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-26 11:06:28 +0200 |
commit | 76487bde40e0e9e60684e42c5b6b4ef2c7781287 (patch) | |
tree | 7255e6bb48f33569d3a939faa8c2581cbdcde12e /src | |
parent | 16121c35b05073144a208f786e4f006497df50bb (diff) | |
download | skyhanni-76487bde40e0e9e60684e42c5b6b4ef2c7781287.tar.gz skyhanni-76487bde40e0e9e60684e42c5b6b4ef2c7781287.tar.bz2 skyhanni-76487bde40e0e9e60684e42c5b6b4ef2c7781287.zip |
Added for lore hider as well, show in lore how to bypass, and using one config value
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt index e28ebee04..b0b984ff6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt @@ -31,6 +31,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class HideNotClickableItems { + private val config get() = SkyHanniMod.feature.inventory private var hideReason = "" private var reverseColor = false @@ -81,7 +82,7 @@ class HideNotClickableItems { fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { if (!LorenzUtils.inSkyBlock) return if (isDisabled()) return - if (SkyHanniMod.feature.inventory.notClickableItemsBypass && LorenzUtils.isControlKeyDown()) return + if (bypasssActive()) return if (event.gui !is GuiChest) return val guiChest = event.gui val chest = guiChest.inventorySlots as ContainerChest @@ -94,10 +95,10 @@ class HideNotClickableItems { if (slot.stack == null) continue if (hide(chestName, slot.stack)) { - val opacity = SkyHanniMod.feature.inventory.hideNotClickableOpacity + val opacity = config.hideNotClickableOpacity val color = LorenzColor.DARK_GRAY.addOpacity(opacity) slot.stack.background = color.rgb - } else if (reverseColor && SkyHanniMod.feature.inventory.hideNotClickableItemsGreenLine) { + } else if (reverseColor && config.hideNotClickableItemsGreenLine) { val color = LorenzColor.GREEN.addOpacity(200) slot.stack.borderLine = color.rgb } @@ -108,6 +109,7 @@ class HideNotClickableItems { fun onTooltip(event: ItemTooltipEvent) { if (isDisabled()) return if (event.toolTip == null) return + if (bypasssActive()) return val guiChest = Minecraft.getMinecraft().currentScreen if (guiChest !is GuiChest) return @@ -127,6 +129,9 @@ class HideNotClickableItems { LorenzUtils.warning("No hide reason for not clickable item!") } else { event.toolTip.add("§c$hideReason") + if (config.notClickableItemsBypass) { + event.toolTip.add(" §7(Disable with holding the control key)") + } } } } @@ -134,8 +139,8 @@ class HideNotClickableItems { @SubscribeEvent fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) { if (isDisabled()) return - if (!SkyHanniMod.feature.inventory.hideNotClickableItemsBlockClicks) return - if (SkyHanniMod.feature.inventory.notClickableItemsBypass && LorenzUtils.isControlKeyDown()) return + if (!config.hideNotClickableItemsBlockClicks) return + if (bypasssActive()) return if (event.gui !is GuiChest) return val chestName = InventoryUtils.openInventoryName() @@ -156,10 +161,12 @@ class HideNotClickableItems { } } + private fun bypasssActive() = config.notClickableItemsBypass && LorenzUtils.isControlKeyDown() + private fun isDisabled(): Boolean { if (bypassUntil > System.currentTimeMillis()) return true - return !SkyHanniMod.feature.inventory.hideNotClickableItems + return !config.hideNotClickableItems } private fun hide(chestName: String, stack: ItemStack): Boolean { |