aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/garden
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-05-22 22:49:34 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-05-22 22:49:34 +0200
commitae5f5045833aa6d127e2fd969f6bb67c6784499d (patch)
tree0cee851205e7bfe27da364573fc998f287c041bc /src/main/java/at/hannibal2/skyhanni/features/garden
parent45c2a9a29f7171a5392ddf03bf9053aaefcfd8d4 (diff)
downloadskyhanni-ae5f5045833aa6d127e2fd969f6bb67c6784499d.tar.gz
skyhanni-ae5f5045833aa6d127e2fd969f6bb67c6784499d.tar.bz2
skyhanni-ae5f5045833aa6d127e2fd969f6bb67c6784499d.zip
- Removed Garden Recent Teleport Pads display
= Moved Teleport Pad features from Garden to Private Island: = Teleport Pad Compact Name = Teleport Pad Inventory Numbers
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenRecentTeleportPadsDisplay.kt64
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenTeleportPadCompactName.kt31
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenTeleportPadInventoryNumber.kt83
3 files changed, 0 insertions, 178 deletions
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<String>()
- private var recentTeleports = mutableListOf<Pair<String, String>>()
- private val pattern =
- "§aWarped from the §r(?<from>.*) Teleport Pad§r§a to the §r(?<to>.*) 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 (?<name>.*)".toPattern()
- private val patternNoName = "§.✦ §cNo Destination".toPattern()
-
- @SubscribeEvent(priority = EventPriority.HIGH)
- fun onRenderLivingB(event: RenderLivingEvent.Specials.Pre<EntityLivingBase>) {
- 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<String, Int> 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<String, Int>()
- 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 = "§.(?<number>.*) 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