aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt
index b7cc4dfaa..1427eb5fb 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt
@@ -13,6 +13,7 @@ import at.hannibal2.skyhanni.events.MobEvent
import at.hannibal2.skyhanni.events.minecraft.ClientDisconnectEvent
import at.hannibal2.skyhanni.events.minecraft.packet.PacketReceivedEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
+import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.CollectionUtils.drainForEach
import at.hannibal2.skyhanni.utils.CollectionUtils.drainTo
import at.hannibal2.skyhanni.utils.CollectionUtils.put
@@ -31,6 +32,7 @@ import net.minecraft.entity.player.EntityPlayer
import net.minecraft.network.play.server.S01PacketJoinGame
import net.minecraft.network.play.server.S0CPacketSpawnPlayer
import net.minecraft.network.play.server.S0FPacketSpawnMob
+import net.minecraft.world.World
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.util.concurrent.ConcurrentLinkedQueue
import java.util.concurrent.atomic.AtomicBoolean
@@ -62,8 +64,41 @@ object MobDetection {
MobData.currentMobs.map {
it.createDeSpawnEvent()
}.forEach { it.postAndCatch() }
+ MobData.retries.clear()
}
+ private fun watchdog() {
+ val world = LorenzUtils.getPlayer()?.worldObj ?: return
+ if (MobData.retries.any { it.value.entity.worldObj != world }) {
+ ChatUtils.chat("Watchdog: Retires")
+ }
+ if (MobData.currentMobs.any { it.watchdogCheck(world) }) {
+ ChatUtils.chat("Watchdog: Current Mobs")
+ }
+ if (MobData.players.any { it.watchdogCheck(world) }) {
+ ChatUtils.chat("Watchdog: Players")
+ }
+ if (MobData.displayNPCs.any { it.watchdogCheck(world) }) {
+ ChatUtils.chat("Watchdog: Display NPCs")
+ }
+ if (MobData.skyblockMobs.any { it.watchdogCheck(world) }) {
+ ChatUtils.chat("Watchdog: SkyBlockMobs")
+ }
+ if (MobData.summoningMobs.any { it.watchdogCheck(world) }) {
+ ChatUtils.chat("Watchdog: Summoning")
+ }
+ if (MobData.special.any { it.watchdogCheck(world) }) {
+ ChatUtils.chat("Watchdog: Special")
+ }
+ if (MobData.notSeenMobs.any { it.watchdogCheck(world) }) {
+ ChatUtils.chat("Watchdog: Not Seen Mobs")
+ }
+ }
+
+ private fun Mob.watchdogCheck(world: World): Boolean =
+ this.baseEntity.worldObj != world || (this.armorStand?.let { it.worldObj != world }
+ ?: false) || this.extraEntities.any { it.worldObj != world }
+
@SubscribeEvent
fun onTick(event: LorenzTickEvent) {
if (shouldClear.get()) { // Needs to work outside skyblock since it needs clearing when leaving skyblock and joining limbo