Predicate

From Minecraft Wiki
Jump to: navigation, search
Information icon.svg
This feature is exclusive to Java Edition.
Grass Block.svg
This page contains content on features that may be included in the next update to Java Edition.
These features have appeared in Java Edition development versions, but the full update containing these features has not been released for Java Edition yet.

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'.
  • block_state_property - Check properties of a block state.
    •  block: A block ID. Test will fail if the block doesn't match.
    •  properties: (Optional) A map of block property names to values. All values are strings. Test will fail if the block doesn't match.
  • damage_source_properties - Check properties of damage source.
    •  properties: map of property:value pairs.
  • entity_present - Returns true if entity is set.
  • 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 location, uses same structure as advancements.
      •  flags: Predicate Flags to be checked.
        •  is_on_fire: Test whether the entity is or is not on fire.
        •  is_sneaking: Test whether the entity is or is not sneaking.
        •  is_sprinting: Test whether the entity is or is not sprinting.
        •  is_swimming: Test whether the entity is or is not swimming.
        •  is_baby: Test whether the entity is or is not a baby variant.
  • 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.
  • 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. Cyclic reference will cause 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.
  • tool_enchantment - Test the tool's enchantments.
    •  enchantments: List of enchantments the tool must have.
      • An enchantment.
        •  enchantment: The enchantment namespaced ID.
        •  levels: The level this enchantment has to be.
          •  min: The minimum level.
          •  max: The maximum level.
  • 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]

Upcoming Java Edition
1.1519w38aAdded predicates to data packs.