minecraft:on_equipment_changed

Allows to specify events to execute when equipment is set in the entity's default equipment slots. Doesn't apply to "minecraft:inventory", use "minecraft:equippable" instead.

Properties

PropertyTypeDefaultWhat it does
slotsList of object[]A list of slot-specific events to execute when the entity's equipment changes in those slots.
slotTextslot.weapon.mainhand, slot.weapon.offhand, slot.armor.head, slot.armor.chest, slot.armor.legs, slot.armor.feet, slot.armor.body"slot.weapon.mainhand"The equipment slot to monitor for changes.
on_equipText""Event to execute when the slot is changed to a non-empty item.
on_unequipText""Event to execute when the slot is changed to an empty item.

Example from the game files

This is how vanilla Sulfur Cube uses it in Minecraft Bedrock 1.26.60.5:

{
  "minecraft:on_equipment_changed": {
    "slots": [
      {
        "slot": "slot.weapon.mainhand",
        "on_equip": "minecraft:on_block_absorbed",
        "on_unequip": "minecraft:on_block_ejected"
      }
    ]
  }
}

Used by 1

Vanilla entities with minecraft:on_equipment_changed in their definition:

Related components