aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/FixGhostEntities.kt13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/FixGhostEntities.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/FixGhostEntities.kt
index bb273efe7..4cc1cc5ae 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/FixGhostEntities.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/FixGhostEntities.kt
@@ -18,10 +18,12 @@ object FixGhostEntities {
private val config get() = SkyHanniMod.feature.misc
private var recentlyRemovedEntities = ArrayDeque<Int>()
+ private var recentlySpawnedEntities = ArrayDeque<Int>()
@SubscribeEvent
fun onWorldChange(event: LorenzWorldChangeEvent) {
recentlyRemovedEntities = ArrayDeque()
+ recentlySpawnedEntities = ArrayDeque()
}
@SubscribeEvent
@@ -34,15 +36,20 @@ object FixGhostEntities {
if (packet.entityID in recentlyRemovedEntities) {
event.cancel()
}
+ recentlySpawnedEntities.addLast(packet.entityID)
} else if (packet is S0FPacketSpawnMob) {
if (packet.entityID in recentlyRemovedEntities) {
event.cancel()
}
+ recentlySpawnedEntities.addLast(packet.entityID)
} else if (packet is S13PacketDestroyEntities) {
for (entityID in packet.entityIDs) {
- recentlyRemovedEntities.addLast(entityID)
- if (recentlyRemovedEntities.size == 10) {
- recentlyRemovedEntities.removeFirst()
+ // ingore entities that got properly spawned and then removed
+ if (entityID !in recentlySpawnedEntities) {
+ recentlyRemovedEntities.addLast(entityID)
+ if (recentlyRemovedEntities.size == 10) {
+ recentlyRemovedEntities.removeFirst()
+ }
}
}
}