Skip to content

[Version 4.0] Attributes

Insane96 edited this page Jan 24, 2023 · 2 revisions

You can change mobs attributes by using the object array attributes.

Attribute

  • attributes: An array of attributes
    • An attribute modifier
      • id: id of the attribute, those are the ones available in vanilla minecraft. mandatory
      • uuid: uuid of the modifier. If omitted a random one will be generated. Multiple modifiers with the same UUID and attribute don't stack
      • modifier_name: The name to identify the modifier. Mandatory
      • amount: Range Object representing the min and max possible modifier value of the attribute. Mandatory
      • operation: The modifier attribute as vanilla minecraft defines. Valid values are "addition", "multiply_base", "multiply_total". Mandatory
      • chance: Modifiable Value Object rapresenting the percentage chance (between 0 and 1) to apply the attribute modifier. If omitted the attribute will always be applied.
      • world_whitelist: World Whitelist Object

Note on Multiple modifiers

Multiple modifiers of the same attribute on the same mob will be additive.
E.g. a Zombie with 50% bonus health and another 100% bonus health will give 150% bonus health

Examples

This example will make spiders have between 15% and 30% more health on spawn.

{
    "mob_id": "minecraft:spider",
    "attributes": [
        {
            "id": "minecraft:generic.max_health",
            "modifier_name": "More Health for Spiders",
            "amount": {
                "min": 0.15,
                "max": 0.30
            },
            "operation": "multiply_base"
        }
    ]
}

This example gives to zombies:

  • Between 0% and 15% more movement speed.
  • Have 50% chance to get 20 more health (so a total of 40 health).
  • 1-3/2-4/4-6 (in Easy/Normal/Hard) more armor.
{
    "mob_id": "minecraft:zombie",
    "attributes": [
        {
            "id": "minecraft:generic.movement_speed",
            "modifier_name": "Speedy Zombies",
            "amount": {
                "min": 0.00,
                "max": 0.15
            },
            "operation": "multiply_base"
        },
        {
            "id": "minecraft:generic.max_health",
            "modifier_name": "+20hp for Zombies",
            "amount": 20,
            "chance": 0.50,
            "operation": "addition"
        },
        {
            "id": "minecraft:generic.armor",
            "modifier_name": "Base armor for Zombies",
            "amount": {
                "min": 2,
                "max": 4,
                "difficulty_modifier": {
                    "operation": "add",
                    "easy": -1,
                    "normal": 0,
                    "hard": 2
                }
            },
            "operation": "addition"
        }
    ]
}
Clone this wiki locally