fix passengers not removing vehicle when destroyed

This commit is contained in:
Bixilon 2023-03-20 09:24:17 +01:00
parent 768f1f8f9b
commit ba0adce043
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -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))