diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-26 07:14:08 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-26 07:14:08 +0100 |
commit | d279599080ba81c17d20c97a45c715caf72db8ef (patch) | |
tree | 5d1144c58a87b7b6d0a99ce7a9efe3f67cbb9fb6 /src | |
parent | 7eff3248e14e0ee5b5c100ce2f2458da5a79bc4c (diff) | |
download | skyhanni-d279599080ba81c17d20c97a45c715caf72db8ef.tar.gz skyhanni-d279599080ba81c17d20c97a45c715caf72db8ef.tar.bz2 skyhanni-d279599080ba81c17d20c97a45c715caf72db8ef.zip |
Added option to enable/disable the vacuum bag item number being capped to 40.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java | 5 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt | 18 |
2 files changed, 21 insertions, 2 deletions
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 @@ -77,6 +77,11 @@ public class InventoryConfig { public List<Integer> 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", desc = "Require Ctrl+Click to craft items that aren't often quick crafted " + 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(?<cap>.*)".toPattern() private val petLevelPattern = "\\[Lvl (?<level>.*)] .*".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" + } + } } } } |