Destroy entities on the client when they are removed from the world

This commit is contained in:
Holly Stubbs 2023-11-05 10:56:57 +00:00
parent 81b5fb302d
commit d64f9469cb
Signed by: tgpholly
GPG key ID: B8583C4B7D18119E

View file

@ -8,6 +8,7 @@ import { Player } from "./entities/Player";
import { HillyGenerator } from "./generators/Hilly";
import { IGenerator } from "./generators/IGenerator";
import { PacketBlockChange } from "./packets/BlockChange";
import { PacketDestroyEntity } from "./packets/DestroyEntity";
import { QueuedBlockUpdate } from "./queuedUpdateTypes/BlockUpdate";
import { IQueuedUpdate } from "./queuedUpdateTypes/IQueuedUpdate";
@ -66,6 +67,7 @@ export class World {
entity.justUnloaded = new Array<number>();
this.players.remove(entity.entityId);
this.sendToNearbyClients(entity, new PacketDestroyEntity(entity.entityId).writeData());
}
this.entites.remove(entity.entityId);