attributes

fun Entity.attributes(editor: AttributeBuilder.() -> Unit)

Extension function to modify entity attributes using a DSL.

This function only works on entities that implement Attributable. If the entity is not Attributable, the editor block is not executed.

Example usage:

entity.attributes {
this[Attribute.GENERIC_MAX_HEALTH] = 20.0
this[Attribute.GENERIC_MOVEMENT_SPEED] = 0.25
}

Parameters

editor

A lambda with receiver that configures the entity's attributes