Predicate

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

Inside a data pack, a predicate is located within.

JSON structure

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

A predicate file may also contain an array of multiple predicate objects, in which case the predicate passes only if all sub-predicates pass.

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


 * block_state_property - Check properties of a block state.
 * : A block ID. The test fails if the block doesn't match.
 * : (Optional) A map of block property names to values. All values are strings. The test fails if the block doesn't match.


 * damage_source_properties - Check properties of damage source.
 * : Predicate applied to the damage source.


 * 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 entity, uses same structure as advancements.


 * 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.
 * : Number Provider. Minimum score.
 * : Number Provider. 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.
 * - optional offsets to location
 * - optional offsets to location
 * - optional offsets to location
 * : Predicate applied to location, uses same structure as advancements.


 * match_tool - Checks tool used to mine the block. Fails when called upon from a non-loot table context.
 * : 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. 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.
 * : Id of enchantment.
 * : List of probabilities for enchantment level, indexed from 0.


 * time_check - Checks the current time
 * : The time value in ticks.
 * : Number Provider. The minimum value.
 * : Number Provider. The maximum value.
 * : If present, time gets modulo-divided by this value (for example, if set to 24000, value operates on a time period of daytime ticks just like ).
 * : If present, time gets modulo-divided by this value (for example, if set to 24000, value operates on a time period of daytime ticks just like ).


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


 * value_check - Checks for range of value
 * : Number Provider. The value to test.
 * : The exact value to check.
 * : The range to check the value.
 * : Number Provider. The minimum value.
 * : Number Provider. The maximum value.

History
Prädikate Prédicat プレディケート 战利品表谓词