Difficulty (Entity Condition Type)

Passes when the world difficulty is one of the listed values.

Passes when the world’s difficulty is one of the values you list.

Type ID: apoli:difficulty

Fields

FieldTypeDefaultDescription
difficultyString or arrayrequiredOne of peaceful, easy, normal, hard, or an array of them. An array passes if the current difficulty is any one of them.

Examples

A single difficulty:

{
  "type": "apoli:difficulty",
  "difficulty": "hard"
}

Several at once — here, a curse that only bites above Easy:

{
  "type": "apoli:action_over_time",
  "interval": 40,
  "entity_action": {
    "type": "apoli:damage",
    "amount": 1,
    "damage_type": "minecraft:magic"
  },
  "condition": {
    "type": "apoli:difficulty",
    "difficulty": ["normal", "hard"]
  }
}

Pair it with apoli:if_else to scale a value rather than switch it on and off:

{
  "type": "apoli:if_else",
  "condition": { "type": "apoli:difficulty", "difficulty": "easy" },
  "if_action":   { "type": "apoli:damage", "amount": 1, "damage_type": "minecraft:magic" },
  "else_action": { "type": "apoli:damage", "amount": 3, "damage_type": "minecraft:magic" }
}

There is also a difficulty variable in expressions, reading 0 for peaceful through 3 for hard — so "amount": "1 + difficulty" scales without a branch at all.