Mob Actions {id="mob-actions"}
AstralMobs registers five custom actions for the AstralCore action DSL, executable in mob-context locations (spawn-actions, death-actions, and goal start/stop/interrupt-actions). Most require the mob context to read or write mob-specific state; one (spawn-mob-location) runs globally and can spawn mobs anywhere in the configuration layer.
All actions support standard action parameters (delay, async — see Actions). Arguments marked required must be present; empty/null arguments are skipped with a silent return.
Action Reference
Action ID | Arguments | Mob Context Required | Effect |
|---|---|---|---|
|
| No | Spawns a blueprint at a location via |
|
| Yes | Writes an arbitrary value into the mob's memory map, readable as |
|
| Yes | (Re)starts a millisecond timer for the mob, readable as |
|
| Yes | Broadcasts an entity-status packet (byte code) interpreted by the client per the spoofed entity type (e.g. Warden, Wither, Evoker), triggering one-shot animations and effects — |
|
| Yes | Writes or clears a client-side entity metadata field by index and data type. Blank/empty |
spawn-mob-location
Spawns a blueprint instance at a location via MobsAPI.spawnMob().
Argument | Type | Required | Description |
|---|---|---|---|
| string (placeholder-resolved) | Yes | Id of a loaded blueprint. Resolved through the action context. |
|
| Yes | Bukkit location to spawn at. Resolved through the action context. |
Mob context: Not required. Usable anywhere actions run (menus, commands, item pipelines).
store-memory
Writes a key-value pair into the mob's in-memory data store, accessible during the mob's lifetime via the %mob_memory_<key>% placeholder.
Argument | Type | Required | Description |
|---|---|---|---|
| string (placeholder-resolved) | Yes | Memory key identifier. Spaces and most punctuation are allowed. |
| any (placeholder-resolved) | Yes | Value to store. Serialized as a string in placeholders but supports any type internally. Can be a literal ( |
Mob context: Required. Throws if not in an NMSMob context.
Memory values are compared in requirements and used to drive goal state machines — tracking shot counts, cooldown durations, or phase flags.
start-timer
Starts (or restarts) a millisecond-resolution timer tracked on the mob, readable as %mob_timer_<key>%.
Argument | Type | Required | Description |
|---|---|---|---|
| string (placeholder-resolved) | Yes | Timer key identifier. |
Mob context: Required. Throws if not in an NMSMob context.
Timers increment independently from spawn. They are the primary tool for cooldown gating: a goal's start-actions restarts its timer, then can-use-requirements check if enough time has elapsed. Starting a timer that already exists resets it to 0.
When a goal's start-actions run on each selection cycle, starting the same timer resets its counter — this is intentional and used to gate repeated uses. A can-continue-requirements check like %mob_timer_some-timer% < 2000 lets the goal keep running for a short window after it started, then stops it once the timer exceeds that threshold.
send-entity-status
Broadcasts an entity-status packet (a.k.a. entity event) to all players tracking the mob. The client interprets the status byte according to the entity type it renders (the spoof type in the blueprint), triggering built-in type-specific animations and effects.
Argument | Type | Required | Description |
|---|---|---|---|
| integer, 0-255 (placeholder-resolved) | Yes | Entity-status code. Interpreted per the spoofed entity type. |
Mob context: Required. Throws if not in an NMSMob context.
Important: Pose-driven animations (e.g., Warden roar, sniff, dig) are not reachable via entity status — they are driven by entity metadata (pose index 6) and require edit-entity-metadata instead.
Common codes (type-specific; check Minecraft source for others):
4— Attack swing (most mobs)61— Warden sniff62— Warden sonic-boom
Example from warden.yml:
edit-entity-metadata
Writes (or clears) a single client-side entity metadata field and immediately broadcasts the change. Metadata overrides are re-asserted to every player tracking the mob every 10 ticks (100ms), ensuring dropped packets or stale state converge on the client.
Argument | Type | Required | Description |
|---|---|---|---|
| integer 0-255 (placeholder-resolved) | Yes | Metadata index to write. Indices 0-15 are shared by all mobs; 16+ are type-specific (e.g., Warden anger, Wither skull count). |
| enum (case-insensitive, dashes → underscores) | Yes | Entity data type: |
| string/number (placeholder-resolved) | No | Value to coerce to the data type. Blank or empty string removes the metadata override, returning control to the server. Byte/short/int accept hex literals ( |
Mob context: Required. Throws if not in an NMSMob context.
Hex values: Byte, short, and int values accept decimal or hexadecimal (0x... prefix) literals. Example: [edit-entity-metadata] 0 BYTE 0x40 sets the entity-flags index to 64.
Metadata indices (type-independent, 0-15):
0— Entity flags (byte, bitmask): standing-on-ground, is-on-fire, is-crouching, etc.6— Pose (EntityPose):STANDING,FALL_FLYING,SLEEPING,SWIMMING,SPIN_ATTACK,ROARING,EMERGING,DIGGING,SNIFFING, etc.9— Health (float, server-side entity data replicated here; setting it does not heal, only cosmetic on client).14— No gravity (boolean).
Type-specific indices (examples):
Wither: index 19 = invulnerable timer (int, ticks) — as used in the shipped
wither.ymlblueprint.
Type-specific indices vary by base entity (vanilla NMS class). Consult NMS entity classes or test with your target mob type to discover which indices matter.
Example from warden.yml (pose sequencing):
Example from wither.yml (health and wither-specific metadata):
Action Lists & Contexts
The five mob actions run in these configuration contexts:
Context | Location | Trigger |
|---|---|---|
| Blueprint root | When the mob is spawned (once per instance). |
| Blueprint root | When the mob dies. |
| Goal definition | When the goal starts (selected from idle/other goals). |
| Goal definition | When the goal stops (interrupted or requirement fails). |
| Goal definition | When a higher-priority goal interrupts this one. |
Spawn and death actions automatically have mob context. Goal-lifecycle actions (start/stop/interrupt) also run in mob context. Non-mob actions (e.g., console, message, sound) can also run in these contexts; only store-memory, start-timer, send-entity-status, and edit-entity-metadata require mob context and will throw if used outside it.
Cross-References
AI Goals, Targeting & Movement — Goal configuration and lifecycle
Blueprint YAML Reference — Top-level
spawn-actionsanddeath-actionsPlaceholders —
%mob_memory_%and%mob_timer_%referenceActions — Action DSL syntax, global parameters, other actions
Functions — Math expressions like
$e(%mob_memory_count%+1)Requirements — Requirement DSL used in goal gate checking
Developer API —
MobsAPI.spawnMob(), NMSMob interface