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 Rebar entities.

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

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

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

Returns the RebarEntity corresponding to this entity, or null if this entity is not a Rebar entity.

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

Returns the RebarEntity with this uuid, or null if the entity does not exist, is not a Rebar 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 RebarEntity corresponding to this entity, or if this entity is not a Rebar entity, or is not of type T.

Link copied to clipboard

Returns all the Rebar entities associated with this key.

Link copied to clipboard

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

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

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

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

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