EffectiveCompositeEntity

A multi-part entity built from two or more EffectiveEntity types linked as parent + children.

getEffectiveEntities returns the parts (index 0 is the parent/root); spawning links them via persistent data so the group can be queried (getChildren, getParent, getCompositesEntities) and is cleaned up together — removing any part removes the whole composite. Requires at least two parts and registers itself on construction.

A built-in /ecomposite <key> command spawns any registered composite in-game.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val CHILD_ENTITIES_KEY: NamespacedKey

Persistent-data key on the parent listing its children's UUIDs.

Link copied to clipboard
val PARENT_ENTITY_KEY: NamespacedKey

Persistent-data key on a child pointing to its parent's UUID.

Functions

Link copied to clipboard
fun additionalKey(name: String): NamespacedKey

Resolves the namespaced key for a single additional arg by name.

Link copied to clipboard
fun createEntities(location: Location?): List<Entity>

Builds all parts (linked parent↔children) at location without adding them to the world.

fun createEntities(location: Location?, additionalArgs: List<String>): List<Entity>

createEntities variant that also applies additionalArgs to the parent.

Link copied to clipboard

Optional per-composite arguments applied to the parent at creation.

Link copied to clipboard
fun getAdditionalArgsNamespacedKeys(): List<Pair<NamespacedKey, PersistentDataType<*, *>>>?

Namespaced keys backing this composite's getAdditionalArgs.

Link copied to clipboard
fun getChild(parent: Entity, namespacedKey: String): Entity?

The child of parent whose entity type matches namespacedKey, or null.

Link copied to clipboard
fun getChildren(parent: Entity): List<Entity?>?

Child entities of parent (may contain nulls for unloaded entities), or null if none stored.

Link copied to clipboard

All live composites of this type as lists of [parent, child…] entities.

Link copied to clipboard

The parts of the composite; index 0 is the parent/root. Must contain at least two.

Link copied to clipboard
abstract fun getNamespacedData(): Pair<JavaPlugin, String>

Owning plugin and a plugin-unique id; together they form the getNamespacedKey.

Link copied to clipboard

Unique identity as "<plugin-name>/<id>", both lowercased.

Link copied to clipboard
fun getParent(possibleChild: Entity): Entity?

The parent (root) entity of possibleChild, or null if it has none.

Link copied to clipboard
fun isParent(possibleChild: Entity, possibleParent: Entity): Boolean

Whether possibleParent is the recorded parent of possibleChild.

Link copied to clipboard
fun spawnEntities(location: Location): List<Entity>

Creates and spawns all parts of the composite at location.

fun spawnEntities(location: Location, additionalArgs: List<String>): List<Entity>

spawnEntities variant that also applies additionalArgs.