old Entity API - latibro/Automation-Mod GitHub Wiki

API to access entities (Entity).

The Entity API may be obtained using the [Interface Box API](Interface Box API).

Usage

local entityAPI = interfaceBox.getAPI("entity")

Lua functions

getAllLoaded

function getAllLoaded() : array<entity : userdata<Entity>>

Returnes all currently loaded entities. 

Entities are only loaded when they are in a loaded chunk.

Returns

  1. array (table) of Entity (userdata)

Usage

local entities = entityAPI.getAllLoaded()

getAllLoadedAsUUID

function getAllLoadedAsUUID() : array<uuid : string>

Returnes the UUID of all loaded entities.

Entities are only loaded when they are in a loaded chunk.

Returns

  1. array (table) af UUID (string)

Usage

local entities = entityAPI.getAllLoadedAsUUID()

getByUUID

function getByUUID(uuid: string) : userdata<Entity>

Returns the entity with the gives UUID.

This will only return to entity if the entity is currently loaded.

Entities are only loaded when they are in a loaded chunk.

Parameters

  1. UUID (string) of the entity

Returns

  1. Entity (userdata) with the given UUID (or nil on errors)

Errors

  • Entity is not loaded

Usage

local entity = entityAPI.getByUUID("f2654a86-f752-4109-9279-ce67b46c3a4e")
⚠️ **GitHub.com Fallback** ⚠️