Guide 1 Docs 2 Reference 3

Function of World

world.on_entity_spawn

Tells after a mob appeared, with its handle and name; a natural spawn fires it on every game version that has one, and a pack's own world.spawn("cow", pos) fires it too. Mob kinds only.

world.on_entity_spawn(fn: (entity: EntityHandle, name: string) -> ()) → Connection

Parameters

fn(entity: EntityHandle, name: string) -> ()required

Returns

Connection

Used in