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