diff options
author | Clicks <58398364+CuzImClicks@users.noreply.github.com> | 2024-09-24 10:26:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 10:26:42 +0200 |
commit | cf039c7e215b26f78eeb468cd911c5d8f8586115 (patch) | |
tree | bf7325da797e330c2e22ea16ee4f0a8b3c94c15a /src/main/java/at/hannibal2/skyhanni/features | |
parent | e4821befd023da38f8a054773e38b3f9a6f28210 (diff) | |
download | skyhanni-cf039c7e215b26f78eeb468cd911c5d8f8586115.tar.gz skyhanni-cf039c7e215b26f78eeb468cd911c5d8f8586115.tar.bz2 skyhanni-cf039c7e215b26f78eeb468cd911c5d8f8586115.zip |
Improvement: Option to hide all Tooltips inside of Excavator (#2579)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorTooltipHider.kt | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorTooltipHider.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorTooltipHider.kt index 8b58402cd..0b0469b91 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorTooltipHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorTooltipHider.kt @@ -3,20 +3,42 @@ package at.hannibal2.skyhanni.features.mining.fossilexcavator import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.RegexUtils.matches +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.client.player.inventory.ContainerLocalMenu import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object ExcavatorTooltipHider { - private val config get() = SkyHanniMod.feature.mining.fossilExcavator + private val config get() = SkyHanniMod.feature.mining.fossilExcavator.tooltipHider + + /** + * REGEX-TEST: §6Dirt + */ + private val dirtPattern by RepoPattern.pattern( + "excavator.dirt.name", + "§6Dirt", + ) @SubscribeEvent fun onTooltip(event: LorenzToolTipEvent) { if (!isEnabled()) return + if (event.slot.inventory !is ContainerLocalMenu) return - event.cancel() + if (config.hideEverything) { + event.cancel() + return + } + + if (config.hideDirt) { + val isDirt = dirtPattern.matches(event.itemStack.name) + if (isDirt) { + event.cancel() + } + } } - fun isEnabled() = FossilExcavatorAPI.inInventory && !FossilExcavatorAPI.inExcavatorMenu && config.hideExcavatorTooltips + fun isEnabled() = FossilExcavatorAPI.inInventory && !FossilExcavatorAPI.inExcavatorMenu } |