From d279599080ba81c17d20c97a45c715caf72db8ef Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 26 Nov 2023 07:14:08 +0100 Subject: Added option to enable/disable the vacuum bag item number being capped to 40. --- .../config/features/inventory/InventoryConfig.java | 5 +++++ .../features/inventory/ItemDisplayOverlayFeatures.kt | 18 ++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java index 7a19fc368..f411bebb7 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java @@ -76,6 +76,11 @@ public class InventoryConfig { ) public List itemNumberAsStackSize = new ArrayList<>(Arrays.asList(3, 11, 12, 14)); + @Expose + @ConfigOption(name = " Vacuum Bag Cap", desc = "Capping the Garden Vacuum Bag item number display to 40.") + @ConfigEditorBoolean + public boolean vacuumBagCap = true; + @Expose @ConfigOption( name = "Quick Craft Confirmation", diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt index 57b3ec36c..e7d6490be 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -21,6 +21,8 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ItemDisplayOverlayFeatures { + private val config get() = SkyHanniMod.feature.inventory + private val rancherBootsSpeedCapPattern = "§7Current Speed Cap: §a(?.*)".toPattern() private val petLevelPattern = "\\[Lvl (?.*)] .*".toPattern() @@ -41,7 +43,7 @@ class ItemDisplayOverlayFeatures { private fun getStackTip(item: ItemStack): String { val itemName = item.cleanName() - val itemNumberAsStackSize = SkyHanniMod.feature.inventory.itemNumberAsStackSize + val itemNumberAsStackSize = config.itemNumberAsStackSize if (itemNumberAsStackSize.contains(0)) { when (itemName) { "First Master Star" -> return "1" @@ -183,7 +185,19 @@ class ItemDisplayOverlayFeatures { for (line in item.getLore()) { gardenVacuumPatterm.matchMatcher(line) { val pests = group("amount").formatNumber() - return if (pests > 39) "§640" else "$pests" + return if (config.vacuumBagCap) { + if (pests > 39) "§640" else "$pests" + } else { + if (pests < 40) { + "$pests" + } else if (pests < 1_000) { + "§6$pests" + } else if (pests < 100_000) { + "§c${pests / 1000}k" + } else { + "§c${pests / 100_000 / 10.0}m" + } + } } } } -- cgit