summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/misc
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-08-17 03:05:34 +0200
committerLorenz <lo.scherf@gmail.com>2022-08-17 03:05:34 +0200
commitef58a94bf31868c4b53218474f0be04c1cd93d97 (patch)
treecb56d5969f8bebf586298475a61c521229663fda /src/main/java/at/hannibal2/skyhanni/misc
parent5669dbf6f68e7cacb2df6a4e37d703df8635353e (diff)
downloadskyhanni-ef58a94bf31868c4b53218474f0be04c1cd93d97.tar.gz
skyhanni-ef58a94bf31868c4b53218474f0be04c1cd93d97.tar.bz2
skyhanni-ef58a94bf31868c4b53218474f0be04c1cd93d97.zip
moving packets around
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/misc')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/misc/ApiData.kt90
-rw-r--r--src/main/java/at/hannibal2/skyhanni/misc/ButtonOnPause.kt51
-rw-r--r--src/main/java/at/hannibal2/skyhanni/misc/CurrentPetDisplay.kt47
-rw-r--r--src/main/java/at/hannibal2/skyhanni/misc/ExpBottleOnGroundHider.kt19
-rw-r--r--src/main/java/at/hannibal2/skyhanni/misc/HypixelData.kt106
-rw-r--r--src/main/java/at/hannibal2/skyhanni/misc/ScoreboardData.kt48
-rw-r--r--src/main/java/at/hannibal2/skyhanni/misc/SummoningSoulsName.kt135
-rw-r--r--src/main/java/at/hannibal2/skyhanni/misc/nether/ashfang/AshfangFreezeCooldown.kt43
-rw-r--r--src/main/java/at/hannibal2/skyhanni/misc/nether/ashfang/AshfangNextResetCooldown.kt53
9 files changed, 0 insertions, 592 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/misc/ApiData.kt b/src/main/java/at/hannibal2/skyhanni/misc/ApiData.kt
deleted file mode 100644
index b0437e852..000000000
--- a/src/main/java/at/hannibal2/skyhanni/misc/ApiData.kt
+++ /dev/null
@@ -1,90 +0,0 @@
-package at.hannibal2.skyhanni.misc
-
-import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.events.LorenzChatEvent
-import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent
-import at.hannibal2.skyhanni.events.ProfileJoinEvent
-import at.hannibal2.skyhanni.utils.APIUtil
-import at.hannibal2.skyhanni.utils.LorenzUtils
-import net.minecraft.client.Minecraft
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-
-class ApiData {
-
- private var currentProfileName = ""
-
- @SubscribeEvent
- fun onStatusBar(event: LorenzChatEvent) {
- val message = event.message
- if (message.startsWith("§aYour new API key is §r§b")) {
- SkyHanniMod.feature.hidden.apiKey = message.substring(26)
- LorenzUtils.chat("§b[SkyHanni] A new API Key has been detected and installed")
-
- if (currentProfileName != "") {
- updateApiData()
- }
- }
- }
-
- @SubscribeEvent
- fun onStatusBar(event: ProfileJoinEvent) {
- currentProfileName = event.name
- updateApiData()
- }
-
- private fun updateApiData() {
- val uuid = Minecraft.getMinecraft().thePlayer.uniqueID.toString().replace("-", "")
-
- val apiKey = SkyHanniMod.feature.hidden.apiKey
-
- if (apiKey.isEmpty()) {
- LorenzUtils.error("SkyHanni has no API Key set. Type /api new to reload.")
- return
- }
-
- val url = "https://api.hypixel.net/player?key=$apiKey&uuid=$uuid"
-
- val jsonObject = APIUtil.getJSONResponse(url)
-
- if (!jsonObject["success"].asBoolean) {
- val cause = jsonObject["cause"].asString
- if (cause == "Invalid API key") {
- LorenzUtils.error("SkyHanni got an API error: Invalid API key! Type /api new to reload.")
- return
- } else {
- throw RuntimeException("API error for url '$url': $cause")
- }
- }
-
- val player = jsonObject["player"].asJsonObject
- val stats = player["stats"].asJsonObject
- val skyblock = stats["SkyBlock"].asJsonObject
- val profiles = skyblock["profiles"].asJsonObject
- for (entry in profiles.entrySet()) {
- val asJsonObject = entry.value.asJsonObject
- val name = asJsonObject["cute_name"].asString
- val profileId = asJsonObject["profile_id"].asString
- if (currentProfileName == name.lowercase()) {
- loadProfile(uuid, profileId)
- return
- }
- }
- }
-
- private fun loadProfile(playerUuid: String, profileId: String) {
- val apiKey = SkyHanniMod.feature.hidden.apiKey
- val url = "https://api.hypixel.net/skyblock/profile?key=$apiKey&profile=$profileId"
-
- val jsonObject = APIUtil.getJSONResponse(url)
-
- val profile = jsonObject["profile"].asJsonObject
- val members = profile["members"].asJsonObject
- for (entry in members.entrySet()) {
- if (entry.key == playerUuid) {
- val profileData = entry.value.asJsonObject
- ProfileApiDataLoadedEvent(profileData).postAndCatch()
-
- }
- }
- }
-} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/misc/ButtonOnPause.kt b/src/main/java/at/hannibal2/skyhanni/misc/ButtonOnPause.kt
deleted file mode 100644
index 68ae8a93c..000000000
--- a/src/main/java/at/hannibal2/skyhanni/misc/ButtonOnPause.kt
+++ /dev/null
@@ -1,51 +0,0 @@
-package at.hannibal2.skyhanni.misc
-
-import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.config.gui.config.ConfigEditor
-import at.hannibal2.skyhanni.config.gui.core.GuiScreenElementWrapper
-import at.hannibal2.skyhanni.utils.LorenzUtils
-import net.minecraft.client.gui.GuiButton
-import net.minecraft.client.gui.GuiIngameMenu
-import net.minecraftforge.client.event.GuiScreenEvent
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-
-class ButtonOnPause {
- private val buttonId = System.nanoTime().toInt()
-
- @SubscribeEvent
- fun onGuiAction(event: GuiScreenEvent.ActionPerformedEvent.Post) {
- if (!LorenzUtils.isOnHypixel) return
-
- if (SkyHanniMod.feature.misc.configButtonOnPause && event.gui is GuiIngameMenu && event.button.id == buttonId) {
- SkyHanniMod.screenToOpen = GuiScreenElementWrapper(
- ConfigEditor(
- SkyHanniMod.feature
- )
- )
- }
- }
-
- @SubscribeEvent
- fun onGuiInitPost(event: GuiScreenEvent.InitGuiEvent.Post) {
- if (!LorenzUtils.isOnHypixel) return
-
- if (SkyHanniMod.feature.misc.configButtonOnPause && event.gui is GuiIngameMenu) {
- val x = event.gui.width - 105
- val x2 = x + 100
- var y = event.gui.height - 22
- var y2 = y + 20
- val sorted = event.buttonList.sortedWith { a, b -> b.yPosition + b.height - a.yPosition + a.height }
- for (button in sorted) {
- val otherX = button.xPosition
- val otherX2 = button.xPosition + button.width
- val otherY = button.yPosition
- val otherY2 = button.yPosition + button.height
- if (otherX2 > x && otherX < x2 && otherY2 > y && otherY < y2) {
- y = otherY - 20 - 2
- y2 = y + 20
- }
- }
- event.buttonList.add(GuiButton(buttonId, x, 0.coerceAtLeast(y), 100, 20, "SkyHanni"))
- }
- }
-} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/misc/CurrentPetDisplay.kt b/src/main/java/at/hannibal2/skyhanni/misc/CurrentPetDisplay.kt
deleted file mode 100644
index 9266dd4f5..000000000
--- a/src/main/java/at/hannibal2/skyhanni/misc/CurrentPetDisplay.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-package at.hannibal2.skyhanni.misc
-
-import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.events.LorenzChatEvent
-import at.hannibal2.skyhanni.utils.GuiRender.renderString
-import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.between
-import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex
-import net.minecraftforge.client.event.RenderGameOverlayEvent
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-
-class CurrentPetDisplay {
-
- @SubscribeEvent
- fun onChatMessage(event: LorenzChatEvent) {
- if (!LorenzUtils.inSkyblock) return
-
- var blocked = false
-
- val message = event.message
- if (message.matchRegex("§aYou summoned your §r(.*)§r§a!")) {
- SkyHanniMod.feature.hidden.currentPet = message.between("your §r", "§r§a")
- blocked = true
- }
- if (message.matchRegex("§cAutopet §eequipped your §7(.*)§e! §a§lVIEW RULE")) {
- SkyHanniMod.feature.hidden.currentPet = message.between("] ", "§e!")
- blocked = true
- }
- if (message.matchRegex("§aYou despawned your §r(.*)§r§a!")) {
- SkyHanniMod.feature.hidden.currentPet = ""
- blocked = true
- }
-
- if (blocked && SkyHanniMod.feature.misc.petDisplay) {
- event.blockedReason = "pets"
- }
- }
-
- @SubscribeEvent
- fun renderOverlay(event: RenderGameOverlayEvent.Post) {
- if (!LorenzUtils.inSkyblock) return
-
- if (!SkyHanniMod.feature.misc.petDisplay) return
-
- SkyHanniMod.feature.misc.petDisplayPos.renderString(SkyHanniMod.feature.hidden.currentPet)
- }
-} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/misc/ExpBottleOnGroundHider.kt b/src/main/java/at/hannibal2/skyhanni/misc/ExpBottleOnGroundHider.kt
deleted file mode 100644
index 119160c4f..000000000
--- a/src/main/java/at/hannibal2/skyhanni/misc/ExpBottleOnGroundHider.kt
+++ /dev/null
@@ -1,19 +0,0 @@
-package at.hannibal2.skyhanni.misc
-
-import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
-import at.hannibal2.skyhanni.utils.LorenzUtils
-import net.minecraft.entity.item.EntityXPOrb
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-
-class ExpBottleOnGroundHider {
- @SubscribeEvent
- fun onCheckRender(event: CheckRenderEntityEvent<*>) {
- if (!LorenzUtils.inSkyblock) return
- if (!SkyHanniMod.feature.misc.hideExpBottles) return
-
- if (event.entity is EntityXPOrb) {
- event.isCanceled = true
- }
- }
-} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/misc/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/misc/HypixelData.kt
deleted file mode 100644
index 177917900..000000000
--- a/src/main/java/at/hannibal2/skyhanni/misc/HypixelData.kt
+++ /dev/null
@@ -1,106 +0,0 @@
-package at.hannibal2.skyhanni.misc
-
-import at.hannibal2.skyhanni.events.LorenzChatEvent
-import at.hannibal2.skyhanni.events.PacketEvent
-import at.hannibal2.skyhanni.events.ProfileJoinEvent
-import at.hannibal2.skyhanni.utils.LorenzUtils.removeColor
-import net.minecraft.client.Minecraft
-import net.minecraft.network.play.server.S38PacketPlayerListItem
-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 {
-
- companion object {
- var hypixel = false
- var skyblock = false
- var dungeon = false
- }
-
- @SubscribeEvent
- fun onConnect(event: FMLNetworkEvent.ClientConnectedToServerEvent) {
- hypixel = Minecraft.getMinecraft().runCatching {
- !event.isLocal && (thePlayer?.clientBrand?.lowercase()?.contains("hypixel")
- ?: currentServerData?.serverIP?.lowercase()?.contains("hypixel") ?: false)
- }.onFailure { it.printStackTrace() }.getOrDefault(false)
- }
-
- val areaRegex = Regex("§r§b§l(?<area>[\\w]+): §r§7(?<loc>[\\w ]+)§r")
-
- @SubscribeEvent
- fun onTabUpdate(event: PacketEvent.ReceiveEvent) {
- if (dungeon || !hypixel || event.packet !is S38PacketPlayerListItem ||
- (event.packet.action != S38PacketPlayerListItem.Action.UPDATE_DISPLAY_NAME &&
- event.packet.action != S38PacketPlayerListItem.Action.ADD_PLAYER)
- ) return
- event.packet.entries.forEach { playerData ->
- val name = playerData?.displayName?.formattedText ?: playerData?.profile?.name ?: return@forEach
- areaRegex.matchEntire(name)?.let { result ->
- dungeon = skyblock && result.groups["area"]?.value == "Dungeon"
- return@forEach
- }
- }
- }
-
- @SubscribeEvent
- fun onWorldChange(event: WorldEvent.Load) {
- skyblock = false
- dungeon = false
- }
-
- @SubscribeEvent
- fun onDisconnect(event: FMLNetworkEvent.ClientDisconnectionFromServerEvent) {
- hypixel = false
- skyblock = false
- dungeon = false
- }
-
- @SubscribeEvent
- fun onStatusBar(event: LorenzChatEvent) {
- if (!hypixel) return
-
- val message = event.message.removeColor().lowercase()
-
- if (message.startsWith("your profile was changed to:")) {
- val stripped = message.replace("your profile was changed to:", "").replace("(co-op)", "").trim()
- ProfileJoinEvent(stripped).postAndCatch()
- }
- if (message.startsWith("you are playing on profile:")) {
- val stripped = message.replace("you are playing on profile:", "").replace("(co-op)", "").trim()
- ProfileJoinEvent(stripped).postAndCatch()
-
- }
- }
-
- var timerTick = 0
-
- @SubscribeEvent
- fun onTick(event: TickEvent.ClientTickEvent) {
- if (!hypixel) return
- if (event.phase != TickEvent.Phase.START) return
-
- timerTick++
-
- if (timerTick % 5 != 0) return
-
- val newState = checkScoreboard()
- if (newState == skyblock) return
-
- skyblock = newState
- }
-
- private fun checkScoreboard(): Boolean {
- val minecraft = Minecraft.getMinecraft()
- val world = minecraft.theWorld ?: return false
-
- val sidebarObjective = world.scoreboard.getObjectiveInDisplaySlot(1) ?: return false
-
- val displayName = sidebarObjective.displayName
-
- return displayName.removeColor().contains("SKYBLOCK")
-
- }
-
-} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/misc/ScoreboardData.kt b/src/main/java/at/hannibal2/skyhanni/misc/ScoreboardData.kt
deleted file mode 100644
index 51bf32e56..000000000
--- a/src/main/java/at/hannibal2/skyhanni/misc/ScoreboardData.kt
+++ /dev/null
@@ -1,48 +0,0 @@
-package at.hannibal2.skyhanni.misc
-
-import at.hannibal2.skyhanni.utils.LorenzUtils.removeColor
-import net.minecraft.client.Minecraft
-import net.minecraft.scoreboard.Score
-import net.minecraft.scoreboard.ScorePlayerTeam
-import net.minecraftforge.fml.common.eventhandler.EventPriority
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import net.minecraftforge.fml.common.gameevent.TickEvent
-
-class ScoreboardData {
-
- companion object {
- var sidebarLines: List<String> = emptyList()
- var sidebarLinesRaw: List<String> = emptyList()
- }
-
- @SubscribeEvent(priority = EventPriority.HIGHEST)
- fun onTick(event: TickEvent.ClientTickEvent) {
- if (event.phase != TickEvent.Phase.START) return
-
- val list = fetchScoreboardLines()
- sidebarLines = list.map { cleanSB(it) }.reversed()
- sidebarLinesRaw = list.reversed()
- }
-
- private fun cleanSB(scoreboard: String): String {
- return scoreboard.removeColor().toCharArray().filter { it.code in 21..126 }.joinToString(separator = "")
- }
-
- fun fetchScoreboardLines(): List<String> {
- val scoreboard = Minecraft.getMinecraft().theWorld?.scoreboard ?: return emptyList()
- val objective = scoreboard.getObjectiveInDisplaySlot(1) ?: return emptyList()
- var scores = scoreboard.getSortedScores(objective)
- val list = scores.filter { input: Score? ->
- input != null && input.playerName != null && !input.playerName
- .startsWith("#")
- }
- scores = if (list.size > 15) {
- list.drop(15)
- } else {
- list
- }
- return scores.map {
- ScorePlayerTeam.formatPlayerName(scoreboard.getPlayersTeam(it.playerName), it.playerName)
- }
- }
-} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/misc/SummoningSoulsName.kt b/src/main/java/at/hannibal2/skyhanni/misc/SummoningSoulsName.kt
deleted file mode 100644
index 4cb1a90ae..000000000
--- a/src/main/java/at/hannibal2/skyhanni/misc/SummoningSoulsName.kt
+++ /dev/null
@@ -1,135 +0,0 @@
-package at.hannibal2.skyhanni.misc
-
-import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.damageindicator.hasNameTagWith
-import at.hannibal2.skyhanni.test.GriffinJavaUtils
-import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture
-import at.hannibal2.skyhanni.utils.LocationUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzVec
-import at.hannibal2.skyhanni.utils.RenderUtils.drawString
-import at.hannibal2.skyhanni.utils.getLorenzVec
-import net.minecraft.client.Minecraft
-import net.minecraft.entity.EntityLiving
-import net.minecraft.entity.item.EntityArmorStand
-import net.minecraftforge.client.event.RenderWorldLastEvent
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import net.minecraftforge.fml.common.gameevent.TickEvent
-import java.util.concurrent.atomic.AtomicReference
-
-class SummoningSoulsName {
-
- var tick = 0
- val texture =
- "ewogICJ0aW1lc3RhbXAiIDogMTYwMTQ3OTI2NjczMywKICAicHJvZmlsZUlkIiA6ICJmMzA1ZjA5NDI0NTg0ZjU" +
- "4YmEyYjY0ZjAyZDcyNDYyYyIsCiAgInByb2ZpbGVOYW1lIiA6ICJqcm9ja2EzMyIsCiAgInNpZ25hdH" +
- "VyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgI" +
- "nVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS81YWY0MDM1ZWMwZGMx" +
- "NjkxNzc4ZDVlOTU4NDAxNzAyMjdlYjllM2UyOTQzYmVhODUzOTI5Y2U5MjNjNTk4OWFkIgogICAgfQogIH0KfQ"
-
- val souls = mutableMapOf<EntityArmorStand, String>()
- val mobsLastLocation = mutableMapOf<EntityLiving, LorenzVec>()
- val mobsName = mutableMapOf<EntityLiving, String>()
-
- @SubscribeEvent
- fun onTick(event: TickEvent.ClientTickEvent) {
- if (!isEnabled()) return
-
- tick++
- //TODO use packets instead of this
- if (tick % 1 == 0) {
- check()
- }
- }
-
- private fun check() {
- val minecraft = Minecraft.getMinecraft()
- val world = minecraft.theWorld
- for (entity in world.loadedEntityList) {
- if (souls.contains(entity)) continue
-
- if (entity is EntityArmorStand) {
- if (isSoul(entity)) {
- val soulLocation = entity.getLorenzVec()
-
- val map = mutableMapOf<EntityLiving, Double>()
- for ((mob, loc) in mobsLastLocation) {
- val distance = loc.distance(soulLocation)
- map[mob] = distance
- }
-
- val nearestMob = GriffinJavaUtils.sortByValueAsc(map).firstNotNullOfOrNull { it.key }
- if (nearestMob != null) {
-// val mobDistance = nearestMob.getLorenzVec().add(0.0, -1.4375, 0.0)
-// val distance = mobDistance.distance(soulLocation)
-// val diff = mobDistance.add(soulLocation.multiply(-1))
-
-// println(" ")
-// println("mobDistance: $mobDistance")
-// println("soulLocation: $soulLocation")
-// println("diff: $diff")
-// LorenzUtils.chat("distance: $distance")
- val name = mobsName[nearestMob]!!
-// LorenzUtils.chat("maybe its $name")
- souls[entity] = name
- }
-
- }
- }
- }
-
- for (entity in world.loadedEntityList) {
-
- if (entity is EntityLiving) {
- val boo = AtomicReference<String>()
- if (entity.hasNameTagWith(2, "§c❤", consumer = {
- if (!it.name.contains("§e0")) {
- boo.set(it.name)
- }
- })) {
- val name = boo.get()
- if (name != null) {
- mobsLastLocation[entity] = entity.getLorenzVec()
- mobsName[entity] = name
- }
- }
- }
- }
-
- souls.keys.removeIf { it !in world.loadedEntityList }
- //TODO fix overhead!
-// mobs.keys.removeIf { it !in world.loadedEntityList }
- }
-
- @SubscribeEvent
- fun onWorldRender(event: RenderWorldLastEvent) {
- if (!isEnabled()) return
-
- val playerLocation = LocationUtils.playerEyeLocation()
- for ((entity, name) in souls) {
- val vec = entity.getLorenzVec()
- if (LocationUtils.canSee(playerLocation, vec.add(0.0, 2.0, 0.0))) {
- event.drawString(vec.add(0.0, 2.5, 0.0), name, true)
- }
- }
- }
-
- private fun isSoul(entity: EntityArmorStand): Boolean {
- for (stack in entity.inventory) {
- if (stack != null) {
- val skullTexture = stack.getSkullTexture()
- if (skullTexture != null) {
- if (skullTexture == texture) {
- return true
- }
- }
- }
- }
-
- return false
- }
-
- private fun isEnabled(): Boolean {
- return LorenzUtils.inSkyblock && SkyHanniMod.feature.misc.summonSoulDisplay
- }
-} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/misc/nether/ashfang/AshfangFreezeCooldown.kt b/src/main/java/at/hannibal2/skyhanni/misc/nether/ashfang/AshfangFreezeCooldown.kt
deleted file mode 100644
index 1a413d0bf..000000000
--- a/src/main/java/at/hannibal2/skyhanni/misc/nether/ashfang/AshfangFreezeCooldown.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-package at.hannibal2.skyhanni.misc.nether.ashfang
-
-import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.events.LorenzChatEvent
-import at.hannibal2.skyhanni.utils.GuiRender.renderString
-import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex
-import net.minecraftforge.client.event.RenderGameOverlayEvent
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.text.DecimalFormat
-
-class AshfangFreezeCooldown {
-
- var lastHit = 0L
-
- @SubscribeEvent
- fun onChatMessage(event: LorenzChatEvent) {
- if (!isEnabled()) return
-
- val message = event.message
- if (message.matchRegex("§cAshfang Follower's Cryogenic Blast hit you for (.*) damage!")) {
- lastHit = System.currentTimeMillis()
- }
- }
-
- @SubscribeEvent
- fun renderOverlay(event: RenderGameOverlayEvent.Post) {
- if (!isEnabled()) return
- val duration = System.currentTimeMillis() - lastHit
- val maxDuration = 3_000
-
- val remainingLong = maxDuration - duration
- if (remainingLong > 0) {
- val remaining = (remainingLong.toFloat() / 1000)
- val format = DecimalFormat("0.0").format(remaining + 0.1)
- SkyHanniMod.feature.abilities.ashfangFreezeCooldownPos.renderString("§cAshfang Freeze: §a${format}s")
- }
- }
-
- private fun isEnabled(): Boolean {
- return LorenzUtils.inSkyblock && SkyHanniMod.feature.abilities.ashfangFreezeCooldown
- }
-} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/misc/nether/ashfang/AshfangNextResetCooldown.kt b/src/main/java/at/hannibal2/skyhanni/misc/nether/ashfang/AshfangNextResetCooldown.kt
deleted file mode 100644
index 7f8373448..000000000
--- a/src/main/java/at/hannibal2/skyhanni/misc/nether/ashfang/AshfangNextResetCooldown.kt
+++ /dev/null
@@ -1,53 +0,0 @@
-package at.hannibal2.skyhanni.misc.nether.ashfang
-
-import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.utils.GuiRender.renderString
-import at.hannibal2.skyhanni.utils.LorenzUtils
-import net.minecraft.client.Minecraft
-import net.minecraft.entity.item.EntityArmorStand
-import net.minecraftforge.client.event.RenderGameOverlayEvent
-import net.minecraftforge.event.world.WorldEvent
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent
-import java.text.DecimalFormat
-
-class AshfangNextResetCooldown {
-
- private var spawnTime = 1L
-
- @SubscribeEvent
- fun renderOverlay(event: ClientTickEvent) {
- if (!isEnabled()) return
-
- if (Minecraft.getMinecraft().theWorld.loadedEntityList.any {
- it is EntityArmorStand && it.posY > 145 &&
- (it.name.contains("§c§9Ashfang Acolyte§r") || it.name.contains("§c§cAshfang Underling§r"))
- }) {
- spawnTime = System.currentTimeMillis()
- }
- }
-
- @SubscribeEvent
- fun renderOverlay(event: RenderGameOverlayEvent.Post) {
- if (!isEnabled()) return
- if (spawnTime == -1L) return
-
- val remainingTime = spawnTime + 46_100 - System.currentTimeMillis()
- if (remainingTime > 0) {
- val remaining = (remainingTime.toFloat() / 1000)
- val format = DecimalFormat("0.0").format(remaining + 0.1)
- SkyHanniMod.feature.abilities.ashfangNextResetCooldownPos.renderString("§cAshfang next reset in: §a${format}s")
- } else {
- spawnTime = -1
- }
- }
-
- @SubscribeEvent
- fun renderOverlay(event: WorldEvent.Load) {
- spawnTime = -1
- }
-
- private fun isEnabled(): Boolean {
- return LorenzUtils.inSkyblock && SkyHanniMod.feature.abilities.ashfangNextResetCooldown
- }
-} \ No newline at end of file