Skip to content

Commit

Permalink
Revert "code cleanup"
Browse files Browse the repository at this point in the history
This reverts commit 8da7ee1.
  • Loading branch information
martimavocado committed Nov 25, 2024
1 parent 75e3882 commit 82c777a
Showing 1 changed file with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import at.hannibal2.skyhanni.utils.compat.EffectsCompat.Companion.activePotionEf
import net.minecraft.block.BlockStainedGlass
import net.minecraft.client.Minecraft
import net.minecraft.client.entity.EntityOtherPlayerMP
import net.minecraft.entity.Entity
import net.minecraft.init.Blocks
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent

Expand All @@ -48,6 +49,9 @@ object DungeonLividFinder {
private set
private var lividArmorStandId: Int? = null

val lividEntityOrArmorstand: Entity?
get() = livid?.baseEntity ?: lividArmorStandId?.let { EntityUtils.getEntityByID(it) }

private var fakeLivids = mutableSetOf<Mob>()

private var color: LorenzColor? = null
Expand All @@ -59,18 +63,23 @@ object DungeonLividFinder {
if (mob.name != "Livid" && mob.name != "Real Livid") return
if (mob.baseEntity !is EntityOtherPlayerMP) return

val lividColor = color ?: run {
val lividColor = color
val isCorrectLivid = if (lividColor == null) false else mob.isLividColor(lividColor)

if (lividColor == null) {
fakeLivids += mob
return
}

livid = mob
lividArmorStandId = mob.armorStand?.entityId
// When the real livid dies at the same time as a fake livid, Hypixel despawns the player entity,
// and makes it impossible to get the mob of the real livid again.
if (isCorrectLivid) {
livid = mob
lividArmorStandId = mob.armorStand?.entityId
// When the real livid dies at the same time as a fake livid, Hypixel despawns the player entity,
// and makes it impossible to get the mob of the real livid again.

ChatUtils.debug("Livid found: $lividColor§7 | $lividArmorStandId")
if (config.enabled) mob.highlight(lividColor.toColor())
ChatUtils.debug("Livid found: $lividColor§7 | $lividArmorStandId")
if (config.enabled) mob.highlight(lividColor.toColor())
} else fakeLivids += mob
}

@SubscribeEvent
Expand Down Expand Up @@ -155,7 +164,7 @@ object DungeonLividFinder {
if (!inLividBossRoom() || !config.enabled) return
if (isBlind) return

val entity = getLividEntityOrArmorStand() ?: return
val entity = lividEntityOrArmorstand ?: return
val lorenzColor = color ?: return

val location = event.exactLocation(entity)
Expand All @@ -171,13 +180,11 @@ object DungeonLividFinder {
}
}

private fun getLividEntityOrArmorStand() = livid?.baseEntity ?: lividArmorStandId?.let { EntityUtils.getEntityByID(it) }

private fun inLividBossRoom() = DungeonAPI.inBossRoom && DungeonAPI.getCurrentBoss() == DungeonFloor.F5

@SubscribeEvent
fun onDebug(event: DebugDataCollectEvent) {
event.title("Dungeon Livid Finder")
event.title("Livid Finder")

if (!inLividBossRoom()) {
event.addIrrelevant {
Expand All @@ -189,7 +196,7 @@ object DungeonLividFinder {
}

event.addData {
add("In Livid Boss")
add("inBoss: ${inLividBossRoom()}")
add("isBlind: $isBlind")
add("blockColor: ${blockLocation.getBlockStateAt()}")
add("livid: '${livid?.armorStand?.name}'")
Expand Down

0 comments on commit 82c777a

Please sign in to comment.