Skip to main content

Item action

Operates on the item stack and its holder from the context. It is not an item definition file; embed it in a field that requires an ItemAction.

Types​

saturn:add_enchantment​

Adds or overrides enchantment levels on the item according to a map.

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:add_enchantment
enchantmentsMap from resource ID to integeryes—Map from enchantment ID to level.
overrideBooleannofalseWhether to override existing values.
Example
{
"type": "saturn:add_enchantment",
"enchantments": {
"minecraft:unbreaking": 1
}
}

saturn:consume_health​

Consumes health from the item holder.

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:consume_health
amountNumber provideryes—Amount or value; a number provider may be a number, a formula string or an object with a type.
Example
{
"type": "saturn:consume_health",
"amount": 1
}

saturn:consume_item​

Reduces the count of the item stack in the context.

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:consume_item
countNumber provideryes—A count, or a count match pattern.
Example
{
"type": "saturn:consume_item",
"count": 1
}

saturn:cooldown​

Reads or sets the cooldown state.

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:cooldown
ticksIntegeryes—Game ticks; 20 ticks is usually one second.
Example
{
"type": "saturn:cooldown",
"ticks": 1
}

saturn:damage_item​

Applies the given durability loss to the item stack.

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:damage_item
amountNumber provideryes—Amount or value; a number provider may be a number, a formula string or an object with a type.
Example
{
"type": "saturn:damage_item",
"amount": 1
}

saturn:holder_action​

Executes an entity action on the item holder.

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:holder_action
actionEntity actionsyes—Nested action of the declared context type.
Example
{
"type": "saturn:holder_action",
"action": {
"type": "saturn:no_op"
}
}

saturn:merge_components​

Merges a data component patch into the item stack.

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:merge_components
componentsObjectyes—Vanilla data component patch.
Example
{
"type": "saturn:merge_components",
"components": {}
}

saturn:remove_enchantment​

Removes selected enchantments from the item, optionally resetting the repair cost.

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:remove_enchantment
enchantmentArray of resource IDsno[]Enchantment ID or list of enchantments.
reset_repair_costBooleannofalseWhether to reset the repair cost when the enchantment is removed.
levelIntegernoomittedHeading level, 1 to 4.
Example
{
"type": "saturn:remove_enchantment"
}

saturn:send_message​

Sends a text component to players that match the recipient condition, optionally to the chat bar or the action bar.

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:send_message
messageText componentyes—Text component sent to players; strings are treated as translation keys.
channelEnum stringno"chat"Message channel; see the enum notes below for available values. Available values: chat, action_bar.
targetEnum stringno"self"Action target, target ID or target selection; see the type description on this page. Available values: self, other, all.
recipientsEntity conditionno{"type":"saturn:always"}Entity condition checked for each candidate recipient player.

channel accepts chat and action_bar. target=self selects the actor / item holder, other selects the bi-entity target, and all selects the players in the current server dimension. Block actions have no recipients of their own, so they usually use all. recipients is checked separately for every candidate player.

Example
{
"type": "saturn:send_message",
"message": {
"text": "Operation complete"
}
}

Meta types​

These types do not test a concrete value themselves; they combine or delegate other types of the same kind and are embedded in the same fields.

saturn:chance​

Decides whether the action fires based on a given chance.

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:chance
actionItem actionyes—The sub-action to run; its kind must match what this field expects.
chanceNumberyes—Hit chance; 0 never fires, 1 always fires. Codec range: 0.0F, 1.0F.
fail_actionItem actionno{"type":"saturn:no_op"}Action to run when the chance check fails.
Example
{
"type": "saturn:chance",
"action": {
"type": "saturn:no_op"
},
"chance": 1
}

saturn:choice​

Picks one action at random by weight and runs it.

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:choice
actionsArray of weighted entries (value, weight)yes—Array of sub-actions; sequential kinds run in order, weighted kinds pick by value and weight.

Each entry contains value and weight; see Weighted entries. Negative weights are treated as 0; when the total weight is 0, an entry is picked uniformly from the non-empty action list. An empty action list does nothing.

Example
{
"type": "saturn:choice",
"actions": [
{
"value": {
"type": "saturn:no_op"
},
"weight": 1
}
]
}

saturn:for_range​

Executes an action a fixed number of times, up to the configured iteration limit.

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:for_range
rangeNumber provideryes—Repetition count, truncated toward zero; negative values execute nothing.
actionItem actionsyes—Nested action of the declared context type.
max_iterationsIntegerno1024Maximum iterations per invocation; must be at least 1.
Example
{
"type": "saturn:for_range",
"range": 3,
"action": {
"type": "saturn:no_op"
}
}

The count is evaluated once before the loop and capped at max_iterations.

saturn:if_else​

Runs if_action when the condition holds, otherwise runs else_action.

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:if_else
conditionItem conditionyes—The condition to check.
if_actionItem actionyes—Action to run when the condition holds.
else_actionItem actionno{"type":"saturn:no_op"}Action to run when the condition does not hold.
Example
{
"type": "saturn:if_else",
"condition": {
"type": "saturn:always"
},
"if_action": {
"type": "saturn:no_op"
}
}

saturn:if_else_list​

Executes the first branch whose condition matches, then stops checking branches.

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:if_else_list
actionsBranch arrayyes—Ordered branches; each entry contains condition and action.

Each actions entry:

FieldTypeRequiredDescription
conditionItemConditionyesCondition selecting this branch.
actionItemActionyesAction to run; later branches are not checked.
Example
{
"type": "saturn:if_else_list",
"actions": [
{
"condition": {
"type": "saturn:always"
},
"action": {
"type": "saturn:no_op"
}
}
]
}

saturn:js​

Calls a callback registered by KubeJS and passes the params argument.

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:js
idStringyes—Identifier of the callback, option or entry.
paramsObjectno{}Parameter object passed to the script or formula.

Registered only when KubeJS is installed. JSON only selects an existing callback; it never executes a JavaScript string inside the JSON directly.

Example
{
"type": "saturn:js",
"id": "example_callback",
"params": {}
}

saturn:no_op​

Does nothing; usable as a placeholder action value.

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:no_op
Example
{
"type": "saturn:no_op"
}

saturn:sequence​

Runs several actions of the same kind in array order.

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:sequence
actionsArray of actions of the same kindyes—Array of sub-actions; sequential kinds run in order, weighted kinds pick by value and weight.
Example
{
"type": "saturn:sequence",
"actions": []
}

saturn:side​

Executes the nested action only on the selected logical side.

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:side
actionItem actionsyes—Nested action of the declared context type.
sideEnum stringyes—Logical side: client or server.
Example
{
"type": "saturn:side",
"side": "server",
"action": {
"type": "saturn:no_op"
}
}

Uses the level’s logical side. An integrated server is server even inside a client process. This action does not send a packet or execute remotely.

saturn:while​

Repeats an action while its condition matches, with a configurable iteration limit.

FieldTypeRequiredDefaultDescription
typeResource IDyes—saturn:while
conditionItem conditionsyes—Filter condition of the declared context type.
actionItem actionsyes—Nested action of the declared context type.
max_iterationsIntegerno1024Maximum iterations per invocation; must be at least 1.
Example
{
"type": "saturn:while",
"max_iterations": 64,
"condition": {
"type": "saturn:never"
},
"action": {
"type": "saturn:no_op"
}
}

The condition is checked before every iteration. If it is still true after max_iterations, the action throws and stops; actions already executed are not rolled back.