Platform: ActionController - Dani-error/velar GitHub Wiki
NPCActionController is a flag-based interface responsible for managing behavior-specific features of an NPC, like how far it can spawn, whether its position should sync on spawn, and more.
It extends NPCFlaggedObject, meaning its logic is built using configurable flags.
It can be created using its Builder, following a standard NPCFlaggedBuilder style.
The builder follows this pattern:
.actionController {
it.flag(NPCActionController.SPAWN_DISTANCE, 20)
}Or multiple flags at once:
.actionController {
it.flags(
NPCActionController.SPAWN_DISTANCE to 20,
NPCActionController.AUTO_SYNC_POSITION_ON_SPAWN to false
)
}| Method | Description |
|---|---|
flag(flag: NPCFlag<T>, value: T?) |
Set a single flag. |
flags(vararg pairs: Pair<NPCFlag<*>, Any?>) |
Set multiple flags at once. |
| Flag Name | Description | Default Value |
|---|---|---|
AUTO_SYNC_POSITION_ON_SPAWN |
Whether the NPC should automatically sync its position when it's spawned. | true |
SPAWN_DISTANCE |
Distance (in blocks) from the player at which the NPC can spawn. Must be ≥ 0. |
50 |
TAB_REMOVAL_TICKS |
Ticks after which the tab entry is removed after spawning (useful for spoofed tab entries). Must be ≥ 0. |
30 |
IMITATE_DISTANCE |
Maximum distance for imitation logic (e.g., mimicking a player). Must be ≥ 0. |
20 |
Learn how to create your own flags.