aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorjani270 <69345714+jani270@users.noreply.github.com>2024-04-17 15:21:17 +0200
committerGitHub <noreply@github.com>2024-04-17 15:21:17 +0200
commita99499ab99aee3e827cd77de50ec07ab81c0baf5 (patch)
tree71c312b4b2b228a41f80f625501eeded9f1852bb /src/main/java/at/hannibal2
parent202512d5f171754613f734b649aa24644b578d06 (diff)
downloadskyhanni-a99499ab99aee3e827cd77de50ec07ab81c0baf5.tar.gz
skyhanni-a99499ab99aee3e827cd77de50ec07ab81c0baf5.tar.bz2
skyhanni-a99499ab99aee3e827cd77de50ec07ab81c0baf5.zip
Feature: Glacite Powder as stack size in Fossil Excavator (#1458)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/mining/FossilExcavatorConfig.java9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/GlacitePowderFeatures.kt33
3 files changed, 44 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index e682ee675..dbca1c71d 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -273,6 +273,7 @@ import at.hannibal2.skyhanni.features.mining.eventtracker.MiningEventDisplay
import at.hannibal2.skyhanni.features.mining.eventtracker.MiningEventTracker
import at.hannibal2.skyhanni.features.mining.fossilexcavator.ExcavatorProfitTracker
import at.hannibal2.skyhanni.features.mining.fossilexcavator.FossilExcavatorAPI
+import at.hannibal2.skyhanni.features.mining.fossilexcavator.GlacitePowderFeatures
import at.hannibal2.skyhanni.features.mining.fossilexcavator.ProfitPerExcavation
import at.hannibal2.skyhanni.features.mining.fossilexcavator.solver.FossilSolverDisplay
import at.hannibal2.skyhanni.features.mining.powdertracker.PowderTracker
@@ -671,6 +672,7 @@ class SkyHanniMod {
loadModule(FossilSolverDisplay)
loadModule(ExcavatorProfitTracker())
loadModule(ProfitPerExcavation())
+ loadModule(GlacitePowderFeatures())
loadModule(GardenOptimalSpeed())
loadModule(GardenLevelDisplay())
loadModule(FarmingWeightDisplay())
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/mining/FossilExcavatorConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/mining/FossilExcavatorConfig.java
index 43f863e94..c8eddb165 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/mining/FossilExcavatorConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/mining/FossilExcavatorConfig.java
@@ -27,4 +27,13 @@ public class FossilExcavatorConfig {
@FeatureToggle
public boolean profitPerExcavation = false;
+ @Expose
+ @ConfigOption(
+ name = "Glacite Powder Stack",
+ desc = "Show Glacite Powder as stack size in the Fossil Excavator."
+ )
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean glacitePowderStack = false;
+
}
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
+}