diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt | 17 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt | 13 |
2 files changed, 17 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index b3e27f011..4d0cce395 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -1,9 +1,6 @@ package at.hannibal2.skyhanni.data -import at.hannibal2.skyhanni.events.HypixelJoinEvent -import at.hannibal2.skyhanni.events.IslandChangeEvent -import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.ProfileJoinEvent +import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -11,7 +8,6 @@ import at.hannibal2.skyhanni.utils.TabListData import net.minecraft.client.Minecraft import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.gameevent.TickEvent import net.minecraftforge.fml.common.network.FMLNetworkEvent class HypixelData { @@ -34,7 +30,7 @@ class HypixelData { fun readSkyBlockArea(): String { return ScoreboardData.sidebarLinesFormatted - .firstOrNull { it.startsWith(" §7⏣ ") } + .firstOrNull { it.startsWith(" §7⏣ ") || it.startsWith(" §5ф ") } ?.substring(5)?.removeColor() ?: "invalid" } @@ -73,14 +69,9 @@ class HypixelData { } } - var tick = 0 - @SubscribeEvent - fun onTick(event: TickEvent.ClientTickEvent) { - if (event.phase != TickEvent.Phase.START) return - - tick++ - if (tick % 5 != 0) return + fun onTick(event: LorenzTickEvent) { + if (!event.isMod(5)) return if (!LorenzUtils.onHypixel) { checkHypixel() diff --git a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt index f463391e3..20d6f4d5c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt @@ -1,13 +1,16 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.events.PlaySoundEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzVec +import net.minecraft.client.Minecraft import net.minecraft.network.play.server.S29PacketSoundEffect import net.minecraft.network.play.server.S2APacketParticles import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent class MinecraftData { @@ -49,4 +52,14 @@ class MinecraftData { event.isCanceled = true } } + + private var tick = 0 + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + if (event.phase != TickEvent.Phase.START) return + Minecraft.getMinecraft().thePlayer ?: return + tick++ + LorenzTickEvent(tick).postAndCatch() + } }
\ No newline at end of file |