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.

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'.
 * 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.
 * This is only true for starvation
 * This is only true for void damage
 * The source cause of the damage. For example, if a skeleton shoots a player with an arrow, the skeleton is the source entity.
 * The direct cause of the damage. For example, if a skeleton shoots a player with an arrow, the arrow is the direct entity.
 * This is only true for starvation
 * This is only true for void damage
 * The source cause of the damage. For example, if a skeleton shoots a player with an arrow, the skeleton is the source entity.
 * The direct cause of the damage. For example, if a skeleton shoots a player with an arrow, the arrow is the direct entity.
 * The source cause of the damage. For example, if a skeleton shoots a player with an arrow, the skeleton is the source entity.
 * The direct cause of the damage. For example, if a skeleton shoots a player with an arrow, the arrow is the direct entity.
 * The direct cause of the damage. For example, if a skeleton shoots a player with an arrow, the arrow is the direct entity.


 * 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.
 * - 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.
 * : 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.
 * : The maximum value.
 * : The minimum value.
 * : If present, time gets modulo-divided by this value (for example, if set to 24000, value operates on a time period of days).
 * : If present, time gets modulo-divided by this value (for example, if set to 24000, value operates on a time period of days).


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


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

History
Prädikate 谓词