aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--FEATURES.md1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Garden.java9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt72
5 files changed, 85 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 90cbd240b..73dfe398f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -56,6 +56,7 @@
+ Added **Composter Upgrade Price** - Show the price for the composter upgrade in the lore
+ Added **Highlight Upgrade** - Highlight Upgrades that can be bought right now.
+ Added **Number Composter Upgrades** - Show the number of upgrades in the composter upgrades inventory.
++ Added **Composter Inventory Numbers** - Show the amount of Organic Matter, Fuel and Composts Available while inside the composter inventory.
### Features from other Mods
diff --git a/FEATURES.md b/FEATURES.md
index aedf7ea42..33bb1e6ec 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -203,6 +203,7 @@
+ **Composter Upgrade Price** - Show the price for the composter upgrade in the lore
+ **Highlight Upgrade** - Highlight Upgrades that can be bought right now.
+ **Number Composter Upgrades** - Show the number of upgrades in the composter upgrades inventory.
++ **Composter Inventory Numbers** - Show the amount of Organic Matter, Fuel and Composts Available while inside the composter inventory.
## Commands
- /wiki (using hypixel-skyblock.fandom.com instead of Hypixel wiki)
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index 61f4315d2..e5169ab86 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -25,6 +25,7 @@ import at.hannibal2.skyhanni.features.event.diana.GriffinBurrowParticleFinder;
import at.hannibal2.skyhanni.features.event.diana.SoopyGuessBurrow;
import at.hannibal2.skyhanni.features.fishing.*;
import at.hannibal2.skyhanni.features.garden.*;
+import at.hannibal2.skyhanni.features.garden.composter.ComposterInventoryNumbers;
import at.hannibal2.skyhanni.features.inventory.*;
import at.hannibal2.skyhanni.features.itemabilities.FireVeilWandParticles;
import at.hannibal2.skyhanni.features.itemabilities.abilitycooldown.ItemAbilityCooldown;
@@ -242,6 +243,7 @@ public class SkyHanniMod {
loadModule(new MinionCollectLogic());
loadModule(new PasteIntoSigns());
loadModule(new EstimatedItemValue());
+ loadModule(new ComposterInventoryNumbers());
Commands.INSTANCE.init();
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
index d433d401e..336e83755 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
@@ -749,6 +749,15 @@ public class Garden {
public Position composterDisplayPos = new Position(-363, 13, false, true);
@Expose
+ @ConfigOption(
+ name = "Inventory Numbers",
+ desc = "Show the amount of Organic Matter, Fuel and Composts Available while inside the composter inventory."
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 17)
+ public boolean composterInventoryNumbers = true;
+
+ @Expose
@ConfigOption(name = "Plot Price", desc = "Show the price of the plot in coins when inside the Configure Plots inventory.")
@ConfigEditorBoolean
public boolean plotPrice = true;
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt
new file mode 100644
index 000000000..51e30ef16
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt
@@ -0,0 +1,72 @@
+package at.hannibal2.skyhanni.features.garden.composter
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent
+import at.hannibal2.skyhanni.features.garden.GardenAPI
+import at.hannibal2.skyhanni.utils.ItemUtils.getLore
+import at.hannibal2.skyhanni.utils.NumberUtil
+import at.hannibal2.skyhanni.utils.StringUtils.removeColor
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.util.regex.Pattern
+
+class ComposterInventoryNumbers {
+ private val valuePattern = Pattern.compile("(?:.*) §e(.*)§6\\/(.*)")
+ private val compostsPattern = Pattern.compile("§7§7Compost Available: §a(.*)")
+
+ @SubscribeEvent
+ fun onRenderItemTip(event: RenderInventoryItemTipEvent) {
+ if (!GardenAPI.inGarden()) return
+ if (!SkyHanniMod.feature.garden.composterInventoryNumbers) return
+
+ if (event.inventoryName != "Composter") return
+
+ val stack = event.stack
+
+ val slotNumber = event.slot.slotNumber
+
+ // Composts Available
+ if (slotNumber == 22) {
+ for (line in stack.getLore()) {
+ val matcher = compostsPattern.matcher(line)
+ if (!matcher.matches()) continue
+
+ val total = matcher.group(1).replace(",", "").toInt()
+ if (total <= 64) continue
+
+ event.offsetY = -2
+ event.offsetX = -20
+ event.stackTip = "§6$total"
+ return
+ }
+ }
+
+ // Organic Matter or Fuel
+ if (slotNumber == 46 || slotNumber == 52) {
+ for (line in stack.getLore()) {
+ val matcher = valuePattern.matcher(line)
+ if (!matcher.matches()) continue
+
+ val having = matcher.group(1).removeColor().replace(",", "").toDouble().toInt()
+ val havingFormat = NumberUtil.format(having)
+ val total = matcher.group(2).removeColor()
+
+
+ val color = if (slotNumber == 46) {
+ // Organic Matter
+ event.offsetY = -95
+ event.offsetX = 5
+ event.alignLeft = false
+ "§e"
+ } else {
+ // Fuel
+ event.offsetY = -76
+ event.offsetX = -20
+ "§a"
+ }
+
+ event.stackTip = "$color$havingFormat/$total"
+ return
+ }
+ }
+ }
+} \ No newline at end of file