From a99499ab99aee3e827cd77de50ec07ab81c0baf5 Mon Sep 17 00:00:00 2001 From: jani270 <69345714+jani270@users.noreply.github.com> Date: Wed, 17 Apr 2024 15:21:17 +0200 Subject: Feature: Glacite Powder as stack size in Fossil Excavator (#1458) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../fossilexcavator/GlacitePowderFeatures.kt | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/GlacitePowderFeatures.kt (limited to 'src/main/java/at/hannibal2/skyhanni/features/mining') 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(?.*)" + ) + + @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 +} -- cgit