diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-29 20:55:13 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-29 20:55:13 +0200 |
commit | 8f57726ec406f8f8056ef54f11051a2bfbd1a69e (patch) | |
tree | ccb6026348191b957a6a78db33595793076c96a0 | |
parent | c48769e6f0962b545de3e02890d3079ed2af9508 (diff) | |
download | skyhanni-8f57726ec406f8f8056ef54f11051a2bfbd1a69e.tar.gz skyhanni-8f57726ec406f8f8056ef54f11051a2bfbd1a69e.tar.bz2 skyhanni-8f57726ec406f8f8056ef54f11051a2bfbd1a69e.zip |
Added Composter Compact Display - Displays the compost data from the tab list in a compact form as gui element
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | FEATURES.md | 5 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java | 1 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/Garden.java | 15 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/ComposterDisplay.kt | 82 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt | 27 |
6 files changed, 125 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 482728305..009d5fef0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ + Added **Teleport Pad Compact Name** - Hide the 'Warp to' and 'No Destination' texts over teleport pads. + Added Money per Hour Advanced stats - Show not only Sell Offer price but also Instant Sell price and NPC Sell price (Suggestion: Enable Compact Price as well for this) + Added Anita Medal Profit - Helps to identify profitable items to buy at the Anita item shop and potential profit from selling the item at the auction house. ++ Added Composter Compact Display - Displays the compost data from the tab list in a compact form as gui element. ### Features from other Mods diff --git a/FEATURES.md b/FEATURES.md index 0f89fb71a..1720b90f5 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -196,8 +196,9 @@ + **Colored Name** - Show the visitor name in the color of the rarity. + **Visitor Item Preview** - Show the base type for the required items next to new visitors (Note that some visitors may require any crop) + **Teleport Pad Compact Name** - Hide the 'Warp to' and 'No Destination' texts over teleport pads. -+ Money per Hour Advanced stats - Show not only Sell Offer price but also Instant Sell price and NPC Sell price (Suggestion: Enable Compact Price as well for this) -+ Added Anita Medal Profit - Helps to identify profitable items to buy at the Anita item shop and potential profit from selling the item at the auction house. ++ **Money per Hour Advanced stats** - Show not only Sell Offer price but also Instant Sell price and NPC Sell price (Suggestion: Enable Compact Price as well for this) ++ **Anita Medal Profit** - Helps to identify profitable items to buy at the Anita item shop and potential profit from selling the item at the auction house. ++ **Composter Compact Display** - Displays the compost data from the tab list in a compact form as gui element. ## 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 1d5281b60..a242ccbc8 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -234,6 +234,7 @@ public class SkyHanniMod { loadModule(new GardenVisitorColorNames()); loadModule(new GardenTeleportPadCompactName()); loadModule(new AnitaMedalProfit()); + loadModule(new ComposterDisplay()); 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 aba49896a..dd78c3095 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java @@ -602,7 +602,22 @@ public class Garden { @Expose public Position anitaMedalProfitPos = new Position(206, 158, false, true); + @Expose + @ConfigOption(name = "Composter", desc = "") + @ConfigEditorAccordion(id = 16) + public boolean composter = false; + @Expose + @ConfigOption( + name = "Compact Display", + desc = "Displays the compost data from the tab list in a compact form as gui element." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 16) + public boolean composterDisplayEnabled = true; + + @Expose + public Position composterDisplayPos = new Position(-363, 13, false, true); @Expose @ConfigOption(name = "Plot Price", desc = "Show the price of the plot in coins when inside the Configure Plots inventory.") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/ComposterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/ComposterDisplay.kt new file mode 100644 index 000000000..7c2b92ebd --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/ComposterDisplay.kt @@ -0,0 +1,82 @@ +package at.hannibal2.skyhanni.features.garden + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.events.TabListUpdateEvent +import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.NEUItems +import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.util.regex.Pattern + +class ComposterDisplay { + private val config get() = SkyHanniMod.feature.garden + private var display = listOf<List<Any>>() + + enum class DataType(val pattern: String, val icon: String) { + ORGANIC_MATTER(" Organic Matter: §r(.*)", "WHEAT"), + FUEL(" Fuel: §r(.*)", "OIL_BARREL"), + TIME_LEFT(" Time Left: §r(.*)", "WATCH"), + STORED_COMPOST(" Stored Compost: §r(.*)", "COMPOST"), + ; + + val displayItem by lazy { + NEUItems.getItemStack(icon) + } + + fun addToList(map: Map<DataType, String>): List<Any> { + return listOf(displayItem, map[this]!!) + } + } + + @SubscribeEvent + fun onTabListUpdate(event: TabListUpdateEvent) { + if (!isEnabled()) return + + var next = false + println(" ") + val data = mutableMapOf<DataType, String>() + + for (line in event.tabList) { + if (line == "§b§lComposter:") { + next = true + continue + } + if (next) { + if (line == "") break + for (type in DataType.values()) { + val pattern = Pattern.compile(type.pattern) + val matcher = pattern.matcher(line) + if (matcher.matches()) { + data[type] = matcher.group(1) + } + } + println("'$line'") + } + } + + val newList = mutableListOf<List<Any>>() + newList.addAsSingletonList("§bComposter") + + newList.add(DataType.TIME_LEFT.addToList(data)) + + val list = mutableListOf<Any>() + list.addAll(DataType.ORGANIC_MATTER.addToList(data)) + list.add(" ") + list.addAll(DataType.FUEL.addToList(data)) + newList.add(list) + + newList.add(DataType.STORED_COMPOST.addToList(data)) + + display = newList + } + + @SubscribeEvent + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { + if (isEnabled()) { + config.composterDisplayPos.renderStringsAndItems(display, posLabel = "Composter Display") + } + } + + fun isEnabled() = config.composterDisplayEnabled && GardenAPI.inGarden() +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt index c35d5cd01..9347cb488 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -1,10 +1,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.ConfigLoadEvent -import at.hannibal2.skyhanni.events.GuiRenderEvent -import at.hannibal2.skyhanni.events.InventoryCloseEvent -import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils @@ -29,6 +26,27 @@ class GardenNextJacobContest { private val contestDuration = 1_000 * 60 * 20 @SubscribeEvent + fun onTabListUpdate(event: TabListUpdateEvent) { + if (!isEnabled()) return + + var next = false + val newList = mutableListOf<String>() + for (line in event.tabList) { + if (line == "§b§lComposter:") { + newList.add(line) + next = true + continue + } + if (next) { + if (line == "") break + newList.add(line) + } + } + + display = newList + } + + @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { if (!isEnabled()) return if (tick++ % (40) != 0) return @@ -137,6 +155,7 @@ class GardenNextJacobContest { } if (contests.isEmpty()) { + list.add("§cOpen calendar to read jacob contest times!") return list } |