Predicate

Predicates are technical JSON files that represent the conditions for loot tables or command. They are a part of data packs.

JSON structure

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

The possible values for and associated extra contents:
 * alternative - Joins conditions from parameter terms with "or".
 * : A list of conditions to join using 'or'.


 * block_state_property - Check properties of a block state.
 * : A block ID. Test will fail if the block doesn't match.
 * : (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.
 * : map of property:value pairs.


 * entity_present - Returns true if entity is set.


 * entity_properties - Test properties of an entity.
 * : Specifies the entity to check for the condition. Set to  to use the entity that died or the player that gained the advancement, opened the container or broke the block,   for the killer, or   for a killer that is a player.
 * : Predicate applied to location, uses same structure as advancements.
 * : Predicate Flags to be checked.
 * : Test whether the entity is or is not on fire.
 * : Test whether the entity is or is not sneaking.
 * : Test whether the entity is or is not sprinting.
 * : Test whether the entity is or is not swimming.
 * : Test whether the entity is or is not a baby variant.


 * entity_scores - Test the scoreboard scores of an entity.
 * : Specifies the entity to check for the condition. Set to  to use the entity that died or the player that gained the advancement, opened the container or broke the block,   for the killer, or   for a killer that is a player.
 * : Scores to check. All specified scores must pass for the condition to pass.
 * : Key name is the objective while the value is the exact score value required for the condition to pass.
 * : Key name is the objective while the value specifies a range of score values required for the condition to pass.
 * : Minimum score.
 * : Maximum score.


 * inverted - Inverts condition from parameter term.
 * : The condition to be negated.


 * killed_by_player - Test if a  entity is available.
 * : If true, the condition passes if  is not available.


 * location_check - Checks if the current location matches.
 * : Predicate applied to location, uses same structure as advancements.


 * match_tool - Checks tool.
 * : Predicate applied to item, uses same structure as advancements.


 * random_chance - Test if a random number 0.0–1.0 is less than a specified value.
 * : 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  entity.
 * : Base success rate.
 * : Looting adjustment to the base success rate. Formula is.


 * reference - Test if another referred condition (predicate) passes.
 * : 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.
 * : Id of enchantment.
 * : List of probabilities for enchantment level, indexed from 0.


 * tool_enchantment - Test the tool's enchantments.
 * : List of enchantments the tool must have.
 * An enchantment.
 * : The enchantment name ID.
 * : The level this enchantment has to be.
 * : The minimum level.
 * : The maximum level.


 * weather_check  - Checks for a current wheather state
 * : If true, the condition evaluates to true only if it's raining.
 * : If true, the condition evaluates to false only if it's thundering.