From ba0adce0432b59670d03ae87ad55083d78d55d0c Mon Sep 17 00:00:00 2001 From: Bixilon Date: Mon, 20 Mar 2023 09:24:17 +0100 Subject: [PATCH] fix passengers not removing vehicle when destroyed --- .../packets/s2c/play/entity/spawn/EntityDestroyS2CP.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/entity/spawn/EntityDestroyS2CP.kt b/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/entity/spawn/EntityDestroyS2CP.kt index 746bf44b7..e77d26271 100644 --- a/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/entity/spawn/EntityDestroyS2CP.kt +++ b/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/entity/spawn/EntityDestroyS2CP.kt @@ -41,7 +41,9 @@ class EntityDestroyS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket { override fun handle(connection: PlayConnection) { for (entityId in entityIds) { val entity = connection.world.entities[entityId] ?: continue - entity.attachment.vehicle?.attachment?.passengers?.remove(entity) + for (passenger in entity.attachment.passengers) { + passenger.attachment.vehicle = null + } connection.world.entities.remove(entityId) connection.events.fire(EntityDestroyEvent(connection, entity))