Loot tables
This commit is contained in:
@@ -20,6 +20,8 @@ export interface EntityHost {
|
||||
send(player: ServerPlayer, message: ServerMessage): void;
|
||||
hurt_player(player: ServerPlayer, amount: number, source: DamageSource): boolean;
|
||||
on_entity_death?(entity: Entity, source: DamageSource): void;
|
||||
// what it drops when it dies, from its loot table
|
||||
entity_loot?(entity: Entity, source: DamageSource): ItemStack[];
|
||||
}
|
||||
|
||||
// what a client was last told about an entity, so only changes get sent
|
||||
@@ -154,6 +156,10 @@ export class EntityManager implements EntityLevel {
|
||||
this.#host.on_entity_death?.(entity, source);
|
||||
}
|
||||
|
||||
entity_loot(entity: Entity, source: DamageSource): ItemStack[] {
|
||||
return this.#host.entity_loot?.(entity, source) ?? [];
|
||||
}
|
||||
|
||||
// ticking
|
||||
|
||||
// every entity active says should move, with their passengers. entities removed along the way are forgotten
|
||||
|
||||
Reference in New Issue
Block a user