EntityType¶
Represents the type of an entity, identified by a unique string that specifies the kind of entity, such as a mob or player.
Example: Count the entities nearby by type
local counts = {}
for _, entity in ipairs(spell:findEntities("@e[distance=..32]")) do
counts[entity.type.id] = (counts[entity.type.id] or 0) + 1
end
for id, count in pairs(counts) do
print(id .. ": " .. count)
end
Fields¶
id: string — Read-Only¶
The unique identifier for the entity type, such as "zombie" or "player".