From ae5f5045833aa6d127e2fd969f6bb67c6784499d Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 22 May 2023 22:49:34 +0200 Subject: - Removed Garden Recent Teleport Pads display = Moved Teleport Pad features from Garden to Private Island: = Teleport Pad Compact Name = Teleport Pad Inventory Numbers --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 7 +- .../hannibal2/skyhanni/config/features/Garden.java | 44 ------------ .../hannibal2/skyhanni/config/features/Misc.java | 18 +++++ .../garden/GardenRecentTeleportPadsDisplay.kt | 64 ----------------- .../garden/GardenTeleportPadCompactName.kt | 31 -------- .../inventory/GardenTeleportPadInventoryNumber.kt | 83 --------------------- .../misc/teleportpad/TeleportPadCompactName.kt | 34 +++++++++ .../misc/teleportpad/TeleportPadInventoryNumber.kt | 84 ++++++++++++++++++++++ 8 files changed, 140 insertions(+), 225 deletions(-) delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/garden/GardenRecentTeleportPadsDisplay.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/garden/GardenTeleportPadCompactName.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenTeleportPadInventoryNumber.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadCompactName.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index a072d0297..d31d50325 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -43,6 +43,8 @@ import at.hannibal2.skyhanni.features.minion.MinionCollectLogic import at.hannibal2.skyhanni.features.minion.MinionFeatures import at.hannibal2.skyhanni.features.misc.* import at.hannibal2.skyhanni.features.misc.discordrpc.DiscordRPCManager +import at.hannibal2.skyhanni.features.misc.teleportpad.TeleportPadCompactName +import at.hannibal2.skyhanni.features.misc.teleportpad.TeleportPadInventoryNumber import at.hannibal2.skyhanni.features.misc.tiarelay.TiaRelayHelper import at.hannibal2.skyhanni.features.misc.tiarelay.TiaRelayWaypoints import at.hannibal2.skyhanni.features.misc.trevor.TrevorFeatures @@ -244,7 +246,7 @@ class SkyHanniMod { loadModule(FarmingArmorDrops()) loadModule(JoinCrystalHollows()) loadModule(GardenVisitorColorNames()) - loadModule(GardenTeleportPadCompactName()) + loadModule(TeleportPadCompactName()) loadModule(AnitaMedalProfit()) loadModule(ComposterDisplay()) loadModule(GardenComposterInventoryFeatures()) @@ -256,7 +258,7 @@ class SkyHanniMod { loadModule(ToolTooltipTweaks()) loadModule(CropSpeedMeter()) loadModule(AshfangMinisNametagHider()) - loadModule(GardenTeleportPadInventoryNumber()) + loadModule(TeleportPadInventoryNumber()) loadModule(ComposterOverlay()) loadModule(DiscordRPCManager) loadModule(GardenCropMilestoneFix()) @@ -267,7 +269,6 @@ class SkyHanniMod { loadModule(GardenYawAndPitch()) loadModule(MovementSpeedDisplay()) loadModule(ChumBucketHider()) - loadModule(GardenRecentTeleportPadsDisplay()) loadModule(InquisitorWaypointShare) loadModule(TrevorFeatures()) loadModule(TrevorSolver) 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 4c63164fb..ff5febe26 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java @@ -891,50 +891,6 @@ public class Garden { @Expose public Position farmingArmorDropsPos = new Position(16, -232, false, true); - @Expose - @ConfigOption(name = "Teleport Pads", desc = "") - @ConfigEditorAccordion(id = 19) - public boolean teleportPads = false; - - @Expose - @ConfigOption(name = "Compact Name", desc = "Hide the 'Warp to' and 'No Destination' texts over teleport pads.") - @ConfigEditorBoolean - @ConfigAccordionId(id = 19) - public boolean teleportPadsCompactName = false; - - @Expose - @ConfigOption(name = "Inventory Numbers", desc = "Show the number of the teleport pads inside the 'Change Destination' inventory as stack size.") - @ConfigEditorBoolean - @ConfigAccordionId(id = 19) - public boolean teleportPadsInventoryNumbers = false; - - @Expose - @ConfigOption(name = "Recent Teleport Pad Display", desc = "") - @Accordion - @ConfigAccordionId(id = 19) - public RecentTeleportPads teleportPadsRecentDisplay = new RecentTeleportPads(); - - public static class RecentTeleportPads { - - @Expose - @ConfigOption(name = "Enabled", desc = "Show the recent teleport pads used in a display.") - @ConfigEditorBoolean - public boolean enabled = false; - - @Expose - @ConfigOption(name = "Only Target", desc = "Hide the 'From' part of the display.") - @ConfigEditorBoolean - public Property onlyTarget = Property.of(false); - - @Expose - @ConfigOption(name = "Hide Chat", desc = "Hide teleport pad chat messages.") - @ConfigEditorBoolean - public boolean hideChat = false; - - @Expose - public Position pos = new Position(206, 158, false, true); - } - @Expose @ConfigOption(name = "Anita Medal Profit", desc = "") @ConfigEditorAccordion(id = 16) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java index 07e2a92c1..82a7ee060 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java @@ -342,6 +342,24 @@ public class Misc { public boolean trapperTalkCooldown = true; } + @ConfigOption(name = "Teleport Pads", desc = "") + @Accordion + @Expose + public TeleportPad teleportPad = new TeleportPad(); + + public static class TeleportPad { + + @Expose + @ConfigOption(name = "Compact Name", desc = "Hide the 'Warp to' and 'No Destination' texts over teleport pads.") + @ConfigEditorBoolean + public boolean compactName = false; + + @Expose + @ConfigOption(name = "Inventory Numbers", desc = "Show the number of the teleport pads inside the 'Change Destination' inventory as stack size.") + @ConfigEditorBoolean + public boolean inventoryNumbers = false; + } + @Expose @ConfigOption(name = "Exp Bottles", desc = "Hides all the experience orbs lying on the ground.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenRecentTeleportPadsDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenRecentTeleportPadsDisplay.kt deleted file mode 100644 index c57c38924..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenRecentTeleportPadsDisplay.kt +++ /dev/null @@ -1,64 +0,0 @@ -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.LorenzChatEvent -import at.hannibal2.skyhanni.utils.LorenzUtils.onToggle -import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings -import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -class GardenRecentTeleportPadsDisplay { - private val config get() = SkyHanniMod.feature.garden.teleportPadsRecentDisplay - private var display = listOf() - private var recentTeleports = mutableListOf>() - private val pattern = - "§aWarped from the §r(?.*) Teleport Pad§r§a to the §r(?.*) Teleport Pad§r§a!".toPattern() - - @SubscribeEvent - fun onChat(event: LorenzChatEvent) { - if (!GardenAPI.inGarden()) return - - pattern.matchMatcher(event.message) { - if (config.enabled) { - recentTeleports.add(Pair(group("from"), group("to"))) - if (recentTeleports.size > 3) recentTeleports.removeFirst() - update() - } - - if (config.hideChat) { - event.blockedReason = "recent_teleport_pads" - } - } - } - - private fun update() { - display = buildList { - add("§6Recent TPs") - for ((from, to) in recentTeleports) { - if (config.onlyTarget.get()) { - add(to) - } else { - add(" $from §7➜ $to") - } - } - } - } - - @SubscribeEvent - fun onConfigLoad(event: ConfigLoadEvent) { - config.onlyTarget.onToggle { - update() - } - } - - @SubscribeEvent - fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { - if (!isEnabled()) return - - config.pos.renderStrings(display, posLabel = "Recent Teleport Pads Display") - } - - fun isEnabled() = GardenAPI.inGarden() && config.enabled -} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenTeleportPadCompactName.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenTeleportPadCompactName.kt deleted file mode 100644 index a23177f39..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenTeleportPadCompactName.kt +++ /dev/null @@ -1,31 +0,0 @@ -package at.hannibal2.skyhanni.features.garden - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher -import net.minecraft.entity.EntityLivingBase -import net.minecraft.entity.item.EntityArmorStand -import net.minecraftforge.client.event.RenderLivingEvent -import net.minecraftforge.fml.common.eventhandler.EventPriority -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -class GardenTeleportPadCompactName { - private val patternName = "§.✦ §aWarp To (?.*)".toPattern() - private val patternNoName = "§.✦ §cNo Destination".toPattern() - - @SubscribeEvent(priority = EventPriority.HIGH) - fun onRenderLivingB(event: RenderLivingEvent.Specials.Pre) { - if (!SkyHanniMod.feature.garden.teleportPadsCompactName) return - val entity = event.entity - if (entity !is EntityArmorStand) return - - val name = entity.name - - patternNoName.matchMatcher(name) { - event.isCanceled = true - } - - patternName.matchMatcher(name) { - entity.customNameTag = group("name") - } - } -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenTeleportPadInventoryNumber.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenTeleportPadInventoryNumber.kt deleted file mode 100644 index 5dc226327..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenTeleportPadInventoryNumber.kt +++ /dev/null @@ -1,83 +0,0 @@ -package at.hannibal2.skyhanni.features.garden.inventory - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.InventoryOpenEvent -import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent -import at.hannibal2.skyhanni.features.garden.GardenAPI -import at.hannibal2.skyhanni.utils.ItemUtils.name -import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -class GardenTeleportPadInventoryNumber { - private val numbers: Map by lazy { - val baseNumber = mapOf( - "one" to 1, - "two" to 2, - "three" to 3, - "four" to 4, - "five" to 5, - "six" to 6, - "seven" to 7, - "eight" to 8, - "nine" to 9, - "ten" to 10, - "eleven" to 11, - "twelve" to 12, - "thirteen" to 13, - "fourteen" to 14, - "fifteen" to 15, - "sixteen" to 16, - "seventeen" to 17, - "eighteen" to 18, - "nineteen" to 19, - ) - val multipliers = mapOf( - "twenty" to 20, - "thirty" to 30, - "forty" to 40, - "fifty" to 50, - "sixty" to 60, - "seventy" to 70, - "eighty" to 80, - "ninety" to 90, - ) - - val result = mutableMapOf() - for (entry in baseNumber) { - result[entry.key] = entry.value - } - - for ((multiplyText, multiplyNumber) in multipliers) { - result[multiplyText] = multiplyNumber - for ((baseText, number) in baseNumber) { - if (number > 9) continue - result[multiplyText + baseText] = multiplyNumber + number - } - } - result - } - - private var inTeleportPad = false - private val pattern = "§.(?.*) teleport pad".toPattern() - - @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { - inTeleportPad = - event.inventoryName == "Set Destination" && SkyHanniMod.feature.garden.teleportPadsInventoryNumbers - } - - @SubscribeEvent - fun onRenderItemTip(event: RenderInventoryItemTipEvent) { - if (!GardenAPI.inGarden()) return - if (!inTeleportPad) return - - val name = event.stack.name?.lowercase() ?: return - - pattern.matchMatcher(name) { - val text = group("number") - numbers[text]?.let { - event.stackTip = "$it" - } - } - } -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadCompactName.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadCompactName.kt new file mode 100644 index 000000000..d09beb3c1 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadCompactName.kt @@ -0,0 +1,34 @@ +package at.hannibal2.skyhanni.features.misc.teleportpad + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import net.minecraft.entity.EntityLivingBase +import net.minecraft.entity.item.EntityArmorStand +import net.minecraftforge.client.event.RenderLivingEvent +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class TeleportPadCompactName { + private val patternName = "§.✦ §aWarp To (?.*)".toPattern() + private val patternNoName = "§.✦ §cNo Destination".toPattern() + + @SubscribeEvent(priority = EventPriority.HIGH) + fun onRenderLivingB(event: RenderLivingEvent.Specials.Pre) { + if (!SkyHanniMod.feature.misc.teleportPad.compactName) return + if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return + val entity = event.entity + if (entity !is EntityArmorStand) return + + val name = entity.name + + patternNoName.matchMatcher(name) { + event.isCanceled = true + } + + patternName.matchMatcher(name) { + entity.customNameTag = group("name") + } + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt new file mode 100644 index 000000000..ba9c78321 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt @@ -0,0 +1,84 @@ +package at.hannibal2.skyhanni.features.misc.teleportpad + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent +import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class TeleportPadInventoryNumber { + private val numbers: Map by lazy { + val baseNumber = mapOf( + "one" to 1, + "two" to 2, + "three" to 3, + "four" to 4, + "five" to 5, + "six" to 6, + "seven" to 7, + "eight" to 8, + "nine" to 9, + "ten" to 10, + "eleven" to 11, + "twelve" to 12, + "thirteen" to 13, + "fourteen" to 14, + "fifteen" to 15, + "sixteen" to 16, + "seventeen" to 17, + "eighteen" to 18, + "nineteen" to 19, + ) + val multipliers = mapOf( + "twenty" to 20, + "thirty" to 30, + "forty" to 40, + "fifty" to 50, + "sixty" to 60, + "seventy" to 70, + "eighty" to 80, + "ninety" to 90, + ) + + val result = mutableMapOf() + for (entry in baseNumber) { + result[entry.key] = entry.value + } + + for ((multiplyText, multiplyNumber) in multipliers) { + result[multiplyText] = multiplyNumber + for ((baseText, number) in baseNumber) { + if (number > 9) continue + result[multiplyText + baseText] = multiplyNumber + number + } + } + result + } + + private var inTeleportPad = false + private val pattern = "§.(?.*) teleport pad".toPattern() + + @SubscribeEvent + fun onInventoryOpen(event: InventoryOpenEvent) { + inTeleportPad = + event.inventoryName == "Set Destination" && SkyHanniMod.feature.misc.teleportPad.inventoryNumbers + } + + @SubscribeEvent + fun onRenderItemTip(event: RenderInventoryItemTipEvent) { + if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return + if (!inTeleportPad) return + + val name = event.stack.name?.lowercase() ?: return + + pattern.matchMatcher(name) { + val text = group("number") + numbers[text]?.let { + event.stackTip = "$it" + } + } + } +} \ No newline at end of file -- cgit