EntityStorage

Basically BlockStorage, but for entities. Works on all the same principles.

See also

Properties

Link copied to clipboard

Functions

Link copied to clipboard

Adds an entity to the storage. This must be called for all newly spawned Pylon entities.

Link copied to clipboard
fun get(uuid: UUID): PylonEntity<*>?

Returns the PylonEntity with this uuid, or null if the entity does not exist or is not a Pylon entity.

fun get(entity: Entity): PylonEntity<*>?

Returns the PylonEntity corresponding to this entity, or null if this entity is not a Pylon entity.

Link copied to clipboard
inline fun <T> getAs(uuid: UUID): T?
fun <T> getAs(clazz: Class<T>, uuid: UUID): T?

Returns the PylonEntity with this uuid, or null if the entity does not exist, is not a Pylon entity, or is not of type T.

inline fun <T> getAs(entity: Entity): T?
fun <T> getAs(clazz: Class<T>, entity: Entity): T?

Returns the PylonEntity corresponding to this entity, or if this entity is not a Pylon entity, or is not of type T.

Link copied to clipboard

Returns all the Pylon entities associated with this key.

Link copied to clipboard

Returns false if the entity is not a PylonEntity or does not exist.

Link copied to clipboard
fun <T : PylonEntity<*>> whenEntityLoads(uuid: UUID, clazz: Class<T>, consumer: Consumer<T>)

Schedules a task to run when the entity with id uuid is loaded, or runs the task immediately if the entity is already loaded.

inline fun <T : PylonEntity<*>> whenEntityLoads(uuid: UUID, crossinline consumer: (T) -> Unit)

Schedules a task to run when the entity with id uuid is loaded, or runs the task immediately if the entity is already loaded