Skip to content

[1.12] Attributes

Alberto Del Villano edited this page Sep 12, 2021 · 1 revision

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

Simple Example

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

{
    "mob_id": "minecraft:creeper",
    "attributes": [
        {
            "id": "generic.maxHealth",
            "modifier": {
                "min": 15,
                "max": 30
            }
        }
    ]
}

Attribute ("attributes")

That's a list of all the keys available for the attribute object, if (optional) is not present then the key is REQUIRED.

  • id: id of the attribute, those are available as vanilla minecraft
  • modifier: (Object) min and max values for the increase / decrease of the attribute
    • min: minimum percentage of increase / decrease of the attribute value
    • max (optional): maximum percentage of increase / decrease of the attribute value (if omitted will be equal to min)
  • is_flat (optional): True if min and max values will be treated as flat values to set as new attribute and not percentages (defaults to false)
  • affected_by_difficulty (optional): true if min and max values should be multiplied by difficulty (0.5 in easy, 1.0 in normal and 2.0 in hard) or local difficulty (defaults to false if difficulty is not present, true otherwise)
  • difficulty (optional): (Object) tags to change how the difficulty behaves on the values.
    • affects_max_only (optional): If true, only the max value will be affected by the difficulty (defaults to false)
    • is_local_difficulty (optional): (true/false) if the chance should be multiplied by the local difficulty, instead of Easy (x0.5), Normal (x1.0) or Hard (x2.0) (by default, those multiplicative values can be changed globally in the config). (defaults to false)
    • multiplier (optional): multiplier for the difficulty, or local difficulty (defaults to 1.0)
  • dimensions (optional): a list of dimensions ids (0 = overworld, -1 = nether, 1 = end) where this attribute modifier should be applied. (if omitted the attribute modifier will be applied no matter in what dimension)
  • biomes (optional): a list of biome ids (if modded biomes the mod namespace must be specified, e.g. "traverse:autumnal_forest") where this attribute modifier should be applied if the mob spawns in this listed biomes. (if omitted the attribute modifier will be applied no matter in what biome)

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 have 150% bonus health

Example

This example gives from 0% to 15% more movement speed to Creepers. Sets his health to 40 (20 hearts). Plus between 5%/10%/20% and 10%/20%/40% (in Easy/Normal/Hard) more follow range.

{
    "mob_id": "minecraft:creeper",
    "attributes": [
        {
            "id": "generic.movementSpeed",
            "modifier": {
                "min": 0,
                "max": 15
            }
        },
        {
            "id": "generic.maxHealth",
            "modifier": {
                "min": 40,
                "max": 40
            },
            "is_flat": true
        },
        {
            "id": "generic.followRange",
            "modifier": {
                "min": 10,
                "max": 20
            },
            "affected_by_difficulty": true
        }
    ]
}
Clone this wiki locally