Skip to content

[Version 4.10] Conditions

Insane96 edited this page May 25, 2024 · 2 revisions

Conditions that can be used in both the mob's properties and modifiable values.

Conditions

That's a list of all the keys available for the Condition object, all the values are optional.

  • is_baby: (Boolean) if the properties should apply only to baby / adult mobs. If omitted will apply to any mob
  • spawner_behaviour: (String) apply properties based off if the mob is spawned / not spawned from a Spawner:
    "none": properties will apply to any mob. Default if omitted
    "spawner_only": properties will apply only to mobs spawned from spawners
    "natural_only": properties will apply only to mobs NOT spawned from spawners
  • structure_behaviour: (String) apply properties based off if the mob is spawned / not spawned from a Structure (like Mansions):
    "none": properties will apply to any mob. If structure_behaviour is omitted, this is the default value
    "structure_only": properties will apply only to mobs spawned from structures
    "natural_only": properties will apply only to mobs NOT spawned from structures
  • world: (World Whitelist Object)
  • advancements_unlocked: (Advancement Objects list).
  • game_stages_unlocked: (Game Stage objects list).
  • nbt: (String) Raw NBT of the mob
  • inverted: (Boolean) If true, the conditions listed are negated

Note

Multiple Advancement Objects in advancements_unlocked work as an OR condition, only one of the advancement objects must be fulfilled.
Game Stage Objects in game_stages_unlocked work as an OR condition, only one of the advancement objects must be fulfilled.

Example

Spiders get 5% more movement speed if the nearest player's advancement "Free the End" has been completed

{
    "target": "minecraft:spider",
    "attributes": [
        {
            "id": "minecraft:generic.movement_speed",
            "modifier_name": "More Speed for Spiders",
            "amount": 0.05,
            "operation": "multiply_base"
        }
    ],
    "conditions": {
        "advancements_unlocked": [
            {
                "advancements": [ "minecraft:end/kill_dragon" ],
                "player_mode": "any"
            }
        ]
    }
}
Clone this wiki locally