From a634e3326a484f2048259fb64cba623dbcde4370 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 11 Nov 2023 14:30:29 +0100 Subject: Fixed the leftStronghold area not getting detected. --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 ++ .../java/at/hannibal2/skyhanni/data/HypixelData.kt | 18 ++---------------- .../at/hannibal2/skyhanni/data/LocationData.kt | 22 ++++++++++++++++++++++ 3 files changed, 26 insertions(+), 16 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/data/LocationData.kt (limited to 'src/main/java/at/hannibal2/skyhanni') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 3f973707d..d3b123c7f 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -22,6 +22,7 @@ import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.ItemClickData import at.hannibal2.skyhanni.data.ItemRenderBackground import at.hannibal2.skyhanni.data.ItemTipHelper +import at.hannibal2.skyhanni.data.LocationData import at.hannibal2.skyhanni.data.MayorElection import at.hannibal2.skyhanni.data.MinecraftData import at.hannibal2.skyhanni.data.OtherInventoryData @@ -337,6 +338,7 @@ class SkyHanniMod { loadModule(this) loadModule(ChatManager) loadModule(HypixelData()) + loadModule(LocationData) loadModule(DungeonAPI()) loadModule(ScoreboardData()) loadModule(SeaCreatureFeatures()) diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 31bb7c047..8b58086a9 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -7,24 +7,18 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent -import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TabListData import net.minecraft.client.Minecraft -import net.minecraft.util.AxisAlignedBB import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.network.FMLNetworkEvent class HypixelData { // TODO USE SH-REPO private val tabListProfilePattern = "§e§lProfile: §r§a(?.*)".toPattern() - private val westVillageFarmArea = AxisAlignedBB(-54.0, 69.0, -115.0, -40.0, 75.0, -127.0) - private val howlingCaveArea = AxisAlignedBB(-401.0, 50.0, -104.0, -337.0, 90.0, 36.0) - private val fakeZealotBruiserHideoutArea = AxisAlignedBB(-520.0, 66.0, -332.0, -558.0, 85.0, -280.0) - private val realZealotBruiserHideoutArea = AxisAlignedBB(-552.0, 50.0, -245.0, -580.0, 72.0, -209.0) companion object { var hypixelLive = false @@ -85,15 +79,7 @@ class HypixelData { .firstOrNull { it.startsWith(" §7⏣ ") || it.startsWith(" §5ф ") } ?.substring(5)?.removeColor() ?: "?" - - skyBlockArea = when { - skyBlockIsland == IslandType.THE_RIFT && westVillageFarmArea.isPlayerInside() -> "Dreadfarm" - skyBlockIsland == IslandType.THE_PARK && howlingCaveArea.isPlayerInside() -> "Howling Cave" - skyBlockIsland == IslandType.THE_END && fakeZealotBruiserHideoutArea.isPlayerInside() -> "The End" - skyBlockIsland == IslandType.THE_END && realZealotBruiserHideoutArea.isPlayerInside() -> "Zealot Bruiser Hideout" - - else -> originalLocation - } + skyBlockArea = LocationData.fixLocation(skyBlockIsland) ?: originalLocation checkProfileName() } @@ -206,4 +192,4 @@ class HypixelData { return scoreboardTitle.contains("SKYBLOCK") || scoreboardTitle.contains("SKIBLOCK") // April 1st jokes are so funny } -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/data/LocationData.kt b/src/main/java/at/hannibal2/skyhanni/data/LocationData.kt new file mode 100644 index 000000000..58ffec3f8 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/data/LocationData.kt @@ -0,0 +1,22 @@ +package at.hannibal2.skyhanni.data + +import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside +import net.minecraft.util.AxisAlignedBB + +object LocationData { + private val westVillageFarmArea = AxisAlignedBB(-54.0, 69.0, -115.0, -40.0, 75.0, -127.0) + private val howlingCaveArea = AxisAlignedBB(-401.0, 50.0, -104.0, -337.0, 90.0, 36.0) + private val fakeZealotBruiserHideoutArea = AxisAlignedBB(-520.0, 66.0, -332.0, -558.0, 85.0, -280.0) + private val realZealotBruiserHideoutArea = AxisAlignedBB(-552.0, 50.0, -245.0, -580.0, 72.0, -209.0) + private val leftStronghold = AxisAlignedBB(-463.7, 94.0, -518.3, -435.3, 115.0, -547.7) + + fun fixLocation(skyBlockIsland: IslandType) = when { + skyBlockIsland == IslandType.THE_RIFT && westVillageFarmArea.isPlayerInside() -> "Dreadfarm" + skyBlockIsland == IslandType.THE_PARK && howlingCaveArea.isPlayerInside() -> "Howling Cave" + skyBlockIsland == IslandType.THE_END && fakeZealotBruiserHideoutArea.isPlayerInside() -> "The End" + skyBlockIsland == IslandType.THE_END && realZealotBruiserHideoutArea.isPlayerInside() -> "Zealot Bruiser Hideout" + skyBlockIsland == IslandType.CRIMSON_ISLE && leftStronghold.isPlayerInside() -> "Stronghold" + + else -> null + } +} -- cgit