From e0ce8cc7152eb32f925203c30c1ff93ab5d3b7d8 Mon Sep 17 00:00:00 2001 From: EnZaXD Date: Thu, 12 Sep 2024 22:09:52 +0200 Subject: [PATCH] Make EntityTrackerBase#clearEntities call removeEntity for all entries (#4142) --- .../viaversion/viaversion/data/entity/EntityTrackerBase.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/com/viaversion/viaversion/data/entity/EntityTrackerBase.java b/common/src/main/java/com/viaversion/viaversion/data/entity/EntityTrackerBase.java index 666e4d5d5..06a74bfd2 100644 --- a/common/src/main/java/com/viaversion/viaversion/data/entity/EntityTrackerBase.java +++ b/common/src/main/java/com/viaversion/viaversion/data/entity/EntityTrackerBase.java @@ -95,7 +95,10 @@ public class EntityTrackerBase implements EntityTracker, ClientEntityIdChangeLis @Override public void clearEntities() { - entities.clear(); + // Call wrapper function in case protocols need to do additional removals + for (final int id : entities.keySet().toIntArray()) { + removeEntity(id); + } } @Override