Skip to content

[Version 4.10] Equipment

Insane96 edited this page Apr 14, 2024 · 5 revisions

Equipment ("equipment")

  • head/chest/legs/feet/main_hand/off_hand: (Object) the equipment slot
    • keep_spawned: (Boolean) if true the equipment will not replace already worn items. E.g. Zombies can naturally spawn with armor, with this set to false, if a zombie spawns with armor or items in hand, those equipment can be replaced. Defaults to false
    • replace_only: (Boolean) if true the equipment will be applied to the slot only if the mob spawned with something in that slot. Defaults to false
    • chance: (Modifiable Value Object) representing the percentage chance (between 0 and 1) to set an item to the slot. If omitted will always try to equip an item
    • drop_chance: (Modifiable Value Object) representing the percentage chance (between 0 and 1) for a mob to drop this item on death. This is affected by Looting as 1% increase per Looting level (defaults to vanilla drop chance)
    • enchantments: (Enchantment Objects list)
      • Enchantment Object
        • id: (Resource location) enchantment id. Either this, random or with_levels must be present
        • random: (Object) Either this, id or with_levels must be present
          • list: (String list) of enchantments to choose from. If omitted, a random enchantment out of all the possible ones for the item will be chosen
          • allow_curses: (Boolean) When false, curses will not be chosen. Defaults to true
          • allow_treasure: (Boolean) When false, treasure enchantments will not be chosen. Defaults to true
        • allow_incompatible: (Boolean) When true, incompatible enchantments can be put together. Defaults to false
        • level: (Range Object) representing the min and max level the enchantments can appear. If omitted, the level will be between the min and max level of the enchantment
        • with_levels: (Range Object) representing levels to enchant the item with. allow_incompatible and level are ignored. Either this, id or random must be present
        • chance: (Modifiable Value Object) representing the percentage chance (between 0 and 1) to apply the enchantment. If omitted the enchantment will always apply.
        • conditions: (Conditions Object)
    • attributes: (Attribute Objects list list) with one more optional field
      • Attribute Object
        • slot: The slot where the attribute will apply. When omitted the attribute will apply in any slot
    • nbt: (String) representing custom NBT data given to the item (E.g. custom names, lore, etc.). You can refer to MCStacker and use the command /give to get the correct nbt (you need to escape double quotes with a backslash, so {display:{Name:'{"text":"Cool Chestplate"}'}} becomes "nbt": "{display:{Name:'{\"text\":\"Cool Chestplate\"}'}}")
    • items: An array with all the possible items to apply to the above slot. Optional. If omitted the above properties will apply to the item already in the mob's hand
      • Item Object
        • id: the item id (e.g. minecraft:iron_sword). Obviously Mandatory
          NOTE: Enchanted Books require you to set the item as enchanted_book and not as book
        • count: (Range Object) representing the amount of items
        • weight: (Modifiable Value Object) representing how often this item will be chosen out of all the items in the array. Basically, items with higher weights will be used more often. If omitted will default to 1
        • drop_chance: (Modifiable Value Object) representing the percentage chance (between 0 and 1) for a mob to drop this item on death. This is affected by Looting as 1% increase per Looting level (defaults to vanilla drop chance)
        • enchantments: (Enchantment Objects list). Same as described above
        • attributes: (Attribute Objects list list). Same as described above
        • nbt: (String). Same as described above

Examples

This example will make zombies have 15% chance to spawn with iron or diamond helmet, with iron begin more common than diamond (~71% for iron and ~29% for diamond).

{
    "target": "minecraft:zombie",
    "equipment": {
        "head": {
            "chance": 0.15,
            "items": [
                {
                    "id": "minecraft:iron_helmet",
                    "weight": 5
                },
                {
                    "id": "minecraft:diamond_helmet",
                    "weight": 2
                }
            ]
        }
    }
}

In this example Skeletons have:

  • 10% chance to wear either a Leather Helmet (91%/80%/60%) or Diamond Helmet (9%/20%/40%) (chances are in easy/normal/hard difficulty).
  • Have 5% chance to get a Diamond Chestplate, only if the skeleton spawns in the the Nether.
    • The chestplate has 50% chance (up to 100% at Y=14) to have Protection IV, will always have either Unbreaking or Mending, is named "Cool Chestplate", gives between 10 and 20 more health to the wearer and has 50% chance to drop on Skeleton's death.
{
    "target": "minecraft:skeleton",
    "equipment": {
        "head": {
            "chance": 0.1,
            "items": [
                {
                    "id": "minecraft:leather_helmet",
                    "weight": {
                        "value": 8,
                        "difficulty_modifier": {
                            "operation": "add",
                            "easy": 2,
                            "hard": -2
                        }
                    }
                },
                {
                    "id": "minecraft:diamond_helmet",
                    "weight": {
                        "value": 2,
                        "difficulty_modifier": {
                            "operation": "add",
                            "easy": -1,
                            "hard": 2
                        }
                    }
                }
            ]
        },
        "chest": {
            "chance": {
                "value": 0.05
            },
            "items": [
                {
                    "id": "minecraft:diamond_chestplate",
                    "weight": 1,
                    "conditions": {
                        "world": {
                            "dimensions": [
                                "minecraft:the_nether"
                            ]
                        }
                    },
                    "drop_chance": 0.5,
                    "enchantments": [
                        {
                            "id": "minecraft:protection",
                            "level": 4,
                            "chance": {
                                "value": 0.5,
                                "pos_modifier": {
                                    "operation": "multiply",
                                    "depth_bonus": 0.01,
                                    "depth_step": 1,
                                    "depth_starting_level": 64
                                }
                            }
                        },
                        {
                            "random": {
                                "list": [
                                    "minecraft:unbreaking",
                                    "minecraft:mending"
                                ]
                            }
                        }
                    ],
                    "attributes": [
                        {
                            "id": "minecraft:generic.max_health",
                            "modifier_name": "Cool Chestplate Bonus Health",
                            "operation": "addition",
                            "amount": {
                                "min": 10,
                                "max": 20
                            }
                        }
                    ],
                    "nbt": "{display:{Name:'{\"text\":\"Cool Chestplate\"}'}"
                }
            ]
        }
    }
}
Clone this wiki locally