diff options
author | Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> | 2024-09-13 20:08:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-13 20:08:53 +0200 |
commit | 0801fef79264784584814b357d39877ffb6d5afb (patch) | |
tree | c2c35be7388cce258b1188862be0032df0b2022e /src/main | |
parent | 6b1c3fa0454315b2fede1cb66f47a2958482525e (diff) | |
download | skyhanni-0801fef79264784584814b357d39877ffb6d5afb.tar.gz skyhanni-0801fef79264784584814b357d39877ffb6d5afb.tar.bz2 skyhanni-0801fef79264784584814b357d39877ffb6d5afb.zip |
Fix: MobDetection Memory Collection (#2504)
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt | 35 |
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 |