Skip to content

Item Actions (Data-Driven)

These item actions are used by the data-driven Games SDK runtime. Actions are defined in JSON and executed by the Minestom server layer when the matching trigger fires.

Triggers

  • use: Player uses the item in hand.
  • use_on_block: Player uses the item on a block.
  • consume: Player consumes the item (use action, then remove if configured).
  • throw: Player drops the item from their hand.

Inheritance

Item definitions can extend another item and override or append actions.

json
{
  "id": "flash_brew",
  "extends": "base_heal_potion",
  "actionMode": { "consume": "append" }
}
  • Use extends (preferred) or extendsId to reference the base item ID.
  • Use actionMode per trigger: append to add to the base list, or omit to replace.

Action Types

message

Send a chat message to the player.

Params:

  • text

command

Run a command as the player or console.

Params:

  • command
  • as: player (default) or console

give_item

Give a custom item or vanilla material.

Params:

  • itemId (custom item ID or minecraft:material)
  • amount (default 1)

remove_item

Consume items from the active hand.

Params:

  • amount (default 1)

ammo

Consume ammunition from the inventory before continuing. This is a guard action that can stop further actions when ammo is missing.

Params:

  • itemId (or item) ammo item ID (minecraft:arrow or custom item ID)
  • amount (default 1)
  • cancel (default true) set to false to continue even when ammo is missing
  • message (optional) chat text when ammo is missing

sound

Play a sound at the player.

Params:

  • sound (or id) sound event key, ex: minecraft:entity.player.levelup
  • source (optional): master, music, record, weather, block, hostile, neutral, player, ambient, voice
  • volume (default 1)
  • pitch (default 1)
  • custom (optional true for resource-pack sounds)
  • range (optional float, custom only)

particle

Spawn a particle at the player.

Params:

  • particle (or id) particle key, ex: minecraft:flash
  • count (default 1)
  • offsetX, offsetY, offsetZ (default 0)
  • speed (default 0)
  • longDistance (optional true)
  • overrideLimiter (optional true)

heal

Restore health.

Params:

  • amount (float, required)

damage

Deal damage to a target entity.

Params:

  • amount (float, required)
  • target (optional): target (default) or self
  • range (default 3.0)
  • lineOfSight (default true)
  • exactView (default false)
  • includePlayers (default false)
  • damageType (optional, default generic) minestom damage type key