As part of the Unified Community Platform project, your wiki will be migrated to the new platform in the next few weeks. Read more here.

Predicate

From Minecraft Wiki
Jump to: navigation, search
Information icon.svg
This feature is exclusive to Java Edition.

Predicates are technical JSON files that represent the conditions for loot tables, /execute if predicate command, or predicate target selector argument. They are a part of data packs.

JSON structure[edit]

  • The root tag.
    •  condition: The condition's ID.
    • Other parts of the condition, specified below.

The possible values for  condition and associated extra contents:

  • alternative - Joins conditions from parameter terms with "or".
    •  terms: A list of conditions to join using 'or'.
      • A condition.
  • block_state_property - Check properties of a block state.
    •  block: A block ID. The test fails if the block doesn't match.
    •  properties: (Optional) A map of block property names to values. All values are strings. The test fails if the block doesn't match.
  • entity_properties - Test properties of an entity.
    •  entity: Specifies the entity to check for the condition. Set to this to use the entity that died or the player that gained the advancement, opened the container or broke the block, killer for the killer, or killer_player for a killer that is a player.
    •  predicate: Predicate applied to entity, uses same structure as advancements.
  • entity_scores - Test the scoreboard scores of an entity.
    •  entity: Specifies the entity to check for the condition. Set to this to use the entity that died or the player that gained the advancement, opened the container or broke the block, killer for the killer, or killer_player for a killer that is a player.
    •  scores: Scores to check. All specified scores must pass for the condition to pass.
      •  A score: Key name is the objective while the value is the exact score value required for the condition to pass.
      •  A score: Key name is the objective while the value specifies a range of score values required for the condition to pass.
        •  min: Minimum score.
        •  max: Maximum score.
  • inverted - Inverts condition from parameter term.
    •  term: The condition to be negated.
  • killed_by_player - Test if a killer_player entity is available.
    •  inverse: If true, the condition passes if killer_player is not available.
  • location_check - Checks if the current location matches.
    •  offsetX - optional offsets to location
    •  offsetY - optional offsets to location
    •  offsetZ - optional offsets to location
    •  predicate: Predicate applied to location, uses same structure as advancements.
  • random_chance - Test if a random number 0.0–1.0 is less than a specified value.
    •  chance: Success rate as a number 0.0–1.0.
  • random_chance_with_looting - Test if a random number 0.0–1.0 is less than a specified value, affected by the level of Looting on the killer entity.
    •  chance: Base success rate.
    •  looting_multiplier: Looting adjustment to the base success rate. Formula is chance + (looting_level * looting_multiplier).
  • reference - Test if another referred condition (predicate) passes.
    •  name: The namespaced ID of the condition (predicate) referred to. A cyclic reference causes a parsing failure.
  • survives_explosion - Returns true with 1/explosion radius probability.
  • table_bonus - Passes with probability picked from table, indexed by enchantment level.
    •  enchantment: Id of enchantment.
    •  chances: List of probabilities for enchantment level, indexed from 0.
  • time_check - Checks the current time
    •  value: The time value in ticks.
    •  value
      •  min: The minimum value.
      •  max: The maximum value.
    •  period: If present, time gets modulo-divided by this value (for example, if set to 24000, value operates on a time period of days).
  • weather_check - Checks for a current weather state
    •  raining: If true, the condition evaluates to true only if it's raining.
    •  thundering: If true, the condition evaluates to true only if it's thundering.

History[edit]

Java Edition
1.1519w38aAdded predicates to data packs.