diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/GlacitePowderFeatures.kt | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/GlacitePowderFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/GlacitePowderFeatures.kt new file mode 100644 index 000000000..18418f959 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/GlacitePowderFeatures.kt @@ -0,0 +1,33 @@ +package at.hannibal2.skyhanni.features.mining.fossilexcavator + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.RenderItemTipEvent +import at.hannibal2.skyhanni.utils.ItemUtils.cleanName +import at.hannibal2.skyhanni.utils.NumberUtil +import at.hannibal2.skyhanni.utils.NumberUtil.formatLong +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class GlacitePowderFeatures { + private val config get() = SkyHanniMod.feature.mining.fossilExcavator + + private val patternGroup = RepoPattern.group("inventory.item.overlay") + + private val glacitePowderPattern by patternGroup.pattern( + "glacitepowder", + "Glacite Powder x(?<amount>.*)" + ) + + @SubscribeEvent + fun onRenderItemTip(event: RenderItemTipEvent) { + if (!isEnabled()) return + + glacitePowderPattern.matchMatcher(event.stack.cleanName()) { + val powder = group("amount").formatLong() + event.stackTip = "§b${NumberUtil.format(powder)}" + } + } + + fun isEnabled() = FossilExcavatorAPI.inInventory && config.glacitePowderStack +} |