Skip to content

EntitySpawnEvent

Triggered whenever an entity is loaded into the world. This event cannot be canceled.

When this event is fired, the entity has just been added to the world and is fully initialized.

Example

local queue = spell:collect("EntitySpawnEvent")
while true do
  local evt = queue:next() --[[@as EntitySpawnEvent]]
  if evt.entity.type.id == "chicken" then
    spell:execute("/attribute " .. evt.entity.uuid .. " minecraft:generic.scale base set 2")
  end
end

Fields

entity: Entity — Read-Only

A reference to the entity being loaded.

name: string — Read-Only

The name of the event.