Table of Contents

Dispense Behaviors

Dispense behaviors execute an action in the world at a specified position when a Dispenser gets a redstone signal. If an item has no dispense behavior defined, it will fall back to the default behavior where it just dispenses the item. The action uses the following context:

Parameter Description
Position this The position of the Dispenser.
target The position as determined by the Dispenser's direction and the specified offset.
Item Stack The item stack to be dispensed from the Dispenser.
Side The direction of the Dispenser.

If the requirements of the action entry do not pass, it will fall back to the default behavior. However, if the action itself it executed unsuccessfully, it either falls back to the default behavior, or does not dispense anything at all, depending on the dispense_as_item_on_failure field.

Fields

Name Description Type Default Value
entry The action to execute. An action
dispense_as_item_on_failure Whether to fall back to the default dispense behavior or to not dispense anything at all if the action fails to execute successfully. An optional boolean true
offset Determines the position to dispense at. An optional offset

Example

{
  "entry": {
    "action": {
      "type": "minecraft:sequence",
      "handler": "minecraft:passing",
      "entries": [
        {
          "action": {
            "type": "minecraft:equip_entity_at_position",
            "position": "target"
          }
        },
        {
          "action": {
            "type": "minecraft:decrement_item",
            "amount": 1
          }
        }
      ]
    }
  },
  "dispense_as_item_on_failure": false
}

Offsets

The offset that determines the target position of the Dispenser to use in the action.

Fields

Name Description Type Default Value
side_factor The factors to multiply the Dispenser's direction's unit vector by. An optional list of three doubles [1.0, 1.0, 1.0]
constant The offset to add to the Dispenser's position, regardless of its direction. An optional list of three doubles [0.0, 0.0, 0.0]

Example

{
  "side_factor": [
    0.7,
    0.7,
    0.7
  ],
  "constant": [
    0.0,
    0.1,
    0.0
  ]
}