<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.sasgaming.net/index.php?action=history&amp;feed=atom&amp;title=Minecraft%3APredicate</id>
	<title>Minecraft:Predicate - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.sasgaming.net/index.php?action=history&amp;feed=atom&amp;title=Minecraft%3APredicate"/>
	<link rel="alternate" type="text/html" href="https://wiki.sasgaming.net/index.php?title=Minecraft:Predicate&amp;action=history"/>
	<updated>2026-04-16T16:52:48Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://wiki.sasgaming.net/index.php?title=Minecraft:Predicate&amp;diff=90356&amp;oldid=prev</id>
		<title>SyncBot: Sync: new page from Minecraft</title>
		<link rel="alternate" type="text/html" href="https://wiki.sasgaming.net/index.php?title=Minecraft:Predicate&amp;diff=90356&amp;oldid=prev"/>
		<updated>2026-04-15T11:14:51Z</updated>

		<summary type="html">&lt;p&gt;Sync: new page from Minecraft&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{For|predicates inside models|Tutorial:Models#Item predicates}}&lt;br /&gt;
{{Exclusive|java}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Predicates&amp;#039;&amp;#039;&amp;#039; are [[Minecraft:JSON]] structures invoked to check conditions within the world. They return a &amp;#039;&amp;#039;pass&amp;#039;&amp;#039; or &amp;#039;&amp;#039;fail&amp;#039;&amp;#039; result to the invoker, which acts differently based on the result. They can be defined and invoked by [[Minecraft:data pack]]s or by [[Minecraft:commands]]. In practical terms, predicates are a flexible way for data packs to encode &amp;quot;if this, then that&amp;quot; logic without needing custom code.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Predicate files&amp;#039;&amp;#039;&amp;#039; are standalone data pack files containing one or more predicates.&lt;br /&gt;
&lt;br /&gt;
This article describes how predicates are defined and invoked, and also describes the JSON structure of a predicate.&lt;br /&gt;
&lt;br /&gt;
== Definition ==&lt;br /&gt;
A predicate file is defined with the [[Minecraft:JSON]] format.&lt;br /&gt;
&lt;br /&gt;
Predicate files are part of the data pack directory structure, highlighted below:&lt;br /&gt;
&lt;br /&gt;
{{Data pack directory|predicate|&amp;lt;nowiki&amp;gt;&amp;lt;name&amp;gt;.json&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
The root element of a predicate file can be either an {{nbt|compound|object}} following the predicate structure below, or an {{nbt|list|array}} containing multiple predicates. In the latter case all predicates must evaluate to true.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
Predicates and predicate files can be invoked in several different manners from other data pack files:&lt;br /&gt;
&lt;br /&gt;
=== Commands ===&lt;br /&gt;
[[Minecraft:Commands]] or [[Minecraft:Function (Java Edition)|functions]] can invoke predicate files in two ways:&lt;br /&gt;
&lt;br /&gt;
* [[Minecraft:Target selectors]]: The selector argument &amp;lt;code&amp;gt;predicate=&amp;lt;/code&amp;gt; checks predicate files as a filter for entity selection. The predicate file is invoked once per entity that needs filtering, each time being at the entity&amp;#039;s location.&lt;br /&gt;
* {{Cmd|execute}}: A subcommand, &amp;lt;code&amp;gt;/execute if predicate&amp;lt;/code&amp;gt;, can invoke a predicate file or an in-line predicate definition to either return a result or to decide whether to continue with a subcommand chain. The predicate is invoked once at the current contextual position of execution.&lt;br /&gt;
&lt;br /&gt;
=== Other predicates ===&lt;br /&gt;
The condition type &amp;lt;code&amp;gt;minecraft:reference&amp;lt;/code&amp;gt; invokes a predicate file and returns the result to the invoker.&lt;br /&gt;
&lt;br /&gt;
=== Presence in other files ===&lt;br /&gt;
In addition to predicate files, predicates themselves are used in other locations within other data pack files such as [[Minecraft:Advancement/JSON format|advancements]] and [[Minecraft:Loot table|loot tables]].&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
Below are a few simple predicate examples for context.&lt;br /&gt;
&lt;br /&gt;
=== Example 1: Check if player is holding a diamond sword ===&lt;br /&gt;
&amp;lt;pre&amp;gt;{&lt;br /&gt;
  &amp;quot;condition&amp;quot;: &amp;quot;minecraft:entity_properties&amp;quot;,&lt;br /&gt;
  &amp;quot;entity&amp;quot;: &amp;quot;this&amp;quot;,&lt;br /&gt;
  &amp;quot;predicate&amp;quot;: {&lt;br /&gt;
    &amp;quot;equipment&amp;quot;: {&lt;br /&gt;
      &amp;quot;mainhand&amp;quot;: {&lt;br /&gt;
        &amp;quot;items&amp;quot;: [&amp;quot;minecraft:diamond_sword&amp;quot;]&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Example 2: Only run if it’s daytime ===&lt;br /&gt;
&amp;lt;pre&amp;gt;{&lt;br /&gt;
  &amp;quot;condition&amp;quot;: &amp;quot;minecraft:time_check&amp;quot;,&lt;br /&gt;
  &amp;quot;value&amp;quot;: { &amp;quot;min&amp;quot;: 0, &amp;quot;max&amp;quot;: 12000 },&lt;br /&gt;
  &amp;quot;period&amp;quot;: 24000&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Example 3: Nested example using any_of ===&lt;br /&gt;
&amp;lt;pre&amp;gt;{&lt;br /&gt;
  &amp;quot;condition&amp;quot;: &amp;quot;minecraft:any_of&amp;quot;,&lt;br /&gt;
  &amp;quot;terms&amp;quot;: [&lt;br /&gt;
    { &amp;quot;condition&amp;quot;: &amp;quot;minecraft:random_chance&amp;quot;, &amp;quot;chance&amp;quot;: 0.25 },&lt;br /&gt;
    { &amp;quot;condition&amp;quot;: &amp;quot;minecraft:weather_check&amp;quot;, &amp;quot;raining&amp;quot;: true }&lt;br /&gt;
  ]&lt;br /&gt;
}&amp;lt;/pre&amp;gt;These snippets can be placed inside {{cd|data/{{ph|namespace}}/predicate/}} within a data pack, then referenced using commands such as:&amp;lt;pre&amp;gt;/execute if predicate my_pack:daytime_check run say Good morning!&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== JSON format ==&lt;br /&gt;
This section describes the JSON format of a predicate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot; style=&amp;quot;margin-block-end: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|list}}{{nbt|compound}}: The root element of the predicate.&lt;br /&gt;
** {{nbt|string|condition}}: The [[Minecraft:resource location]] of the condition type to check.&lt;br /&gt;
** Other parts of the predicate, specified below. In lists each element must evaluate to true for the predicate to pass.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The possible values for {{nbt|string|condition}} and associated extra contents:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot; id=&amp;quot;condition_all_of&amp;quot; style=&amp;quot;margin-block-end: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;all_of&amp;#039;&amp;#039;&amp;#039;&amp;amp;mdash;Evaluates a list of predicates and passes if all of them pass. Invokable from &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;any context&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt;.&lt;br /&gt;
** {{nbt|list|terms}}: The list of predicates to evaluate.&lt;br /&gt;
*** {{nbt|list}}{{nbt|compound}} A predicate, following this structure recursively.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot; id=&amp;quot;condition_alternative&amp;quot; style=&amp;quot;margin-block-end: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;any_of&amp;#039;&amp;#039;&amp;#039;&amp;amp;mdash;Evaluates a list of predicates and passes if any one of them passes. Invokable from &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;any context&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt;.&lt;br /&gt;
** {{nbt|list|terms}}: The list of predicates to evaluate.&lt;br /&gt;
*** {{nbt|list}}{{nbt|compound}} A predicate, following this structure recursively. Note that &amp;#039;&amp;#039;any_of&amp;#039;&amp;#039; only applies to {{nbt|list|terms}}, nested lists are &amp;#039;&amp;#039;all_of&amp;#039;&amp;#039;.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot; id=&amp;quot;condition_block_state_property&amp;quot; style=&amp;quot;margin-block-end: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;block_state_property&amp;#039;&amp;#039;&amp;#039;&amp;amp;mdash;Checks the mined block and its [[Minecraft:block states]]. Requires &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;block state&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt; provided by [[Minecraft:loot context]], and always &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#d33&amp;quot;&amp;gt;fails&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt; if not provided.&lt;br /&gt;
** {{nbt|string|block}}: A block ID. The test fails if the block doesn&amp;#039;t match.&lt;br /&gt;
** {{nbt|compound|properties}}: &amp;#039;&amp;#039;(Optional)&amp;#039;&amp;#039; A map of block state names to values. Errors if the block doesn&amp;#039;t have these properties.&lt;br /&gt;
*** {{nbt|string|&amp;#039;&amp;#039;name&amp;#039;&amp;#039;}}: A block state and an exact value. The value is a string.&lt;br /&gt;
*** {{nbt|compound|&amp;#039;&amp;#039;name&amp;#039;&amp;#039;}}: A block state name and a ranged value to match.&lt;br /&gt;
**** {{nbt|string|min}}: The min value.&lt;br /&gt;
**** {{nbt|string|max}}: The max value.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot; id=&amp;quot;condition_damage_source_properties&amp;quot; style=&amp;quot;margin-block-end: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;damage_source_properties&amp;#039;&amp;#039;&amp;#039;&amp;amp;mdash;Checks properties of the damage source. Requires &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;origin&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;damage source&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt; provided by [[Minecraft:loot context]], and always &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#d33&amp;quot;&amp;gt;fails&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt; if not provided.&lt;br /&gt;
** {{nbt|compound|predicate}}: Predicate applied to the damage source.&lt;br /&gt;
*** {{Nbt_inherit/conditions/damage_type|indent=***}}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot; id=&amp;quot;condition_entity_properties&amp;quot; style=&amp;quot;margin-block-end: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;enchantment_active_check&amp;#039;&amp;#039;&amp;#039;&amp;amp;mdash;Checks if the enchantment has been active. Requires &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;enchantment active status&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt; provided by [[Minecraft:loot context]], and always &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#d33&amp;quot;&amp;gt;fails&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt; if not provided. It is therefore only usable from the {{cd|enchanted_location}} loot context. &lt;br /&gt;
** {{nbt|boolean|active}}: Whether to check for an active ({{cd|true}}) or inactive ({{cd|false}}) enchantment.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot; id=&amp;quot;condition_entity_properties&amp;quot; style=&amp;quot;margin-block-end: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;entity_properties&amp;#039;&amp;#039;&amp;#039;&amp;amp;mdash;Checks properties of an entity. Invokable from &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;any context&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt;.&lt;br /&gt;
** {{nbt|string|entity}}: The entity to check. Specifies an entity from [[Minecraft:loot context]]. Can be {{Loot entity target}}.&lt;br /&gt;
** {{nbt|compound|predicate}}: Predicate applied to entity, uses same structure as advancements.&lt;br /&gt;
*** {{nbt inherit/conditions/entity|indent=***}}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot; id=&amp;quot;condition_entity_scores&amp;quot; style=&amp;quot;margin-block-end: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;entity_scores&amp;#039;&amp;#039;&amp;#039;&amp;amp;mdash;Checks the [[Minecraft:scoreboard]] scores of an entity. Requires &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;the specified entity&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt; provided by [[Minecraft:loot context]], and always &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#d33&amp;quot;&amp;gt;fails&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt; if not provided.&lt;br /&gt;
** {{nbt|string|entity}}: The entity to check. Specifies an entity from [[Minecraft:loot context]]. Can be {{Loot entity target}}.&lt;br /&gt;
** {{nbt|compound|scores}}: Scores to check. All specified scores must pass for the condition to pass.&lt;br /&gt;
*** {{nbt|compound|A score}}: Key name is the objective while the value specifies a range of score values required for the condition to pass.&lt;br /&gt;
**** {{nbt|int}}{{nbt|compound|min}}: A [[Minecraft:Loot table#Number provider|number provider]]. Minimum score. Optional.&lt;br /&gt;
**** {{nbt|int}}{{nbt|compound|max}}: A [[Minecraft:Loot table#Number provider|number provider]]. Maximum score. Optional.&lt;br /&gt;
*** {{nbt|int|A score}}: Shorthand version of the other syntax above, to check the score against a single number only. Key name is the objective while the value is the required score.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot; id=&amp;quot;condition_inverted&amp;quot; style=&amp;quot;margin-block-end: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;inverted&amp;#039;&amp;#039;&amp;#039;&amp;amp;mdash;Inverts another predicate condition. Invokable from &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;any context&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt;.&lt;br /&gt;
** {{nbt|compound|term}}: The condition to be negated, following the same structure as outlined here, recursively.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot; id=&amp;quot;condition_killed_by_player&amp;quot; style=&amp;quot;margin-block-end: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;killed_by_player&amp;#039;&amp;#039;&amp;#039;&amp;amp;mdash;Checks if there is a {{cd|attacking_player}} entity provided by [[Minecraft:loot context]]. Requires &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;{{cd|attacking_player}} entity&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt; provided by [[Minecraft:loot context]], and always &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#d33&amp;quot;&amp;gt;fails&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt; if not provided.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot; id=&amp;quot;condition_location_check&amp;quot; style=&amp;quot;margin-block-end: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;location_check&amp;#039;&amp;#039;&amp;#039;&amp;amp;mdash;Checks the current location against location criteria. Requires &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;origin&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt; provided by [[Minecraft:loot context]], and always &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#d33&amp;quot;&amp;gt;fails&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt; if not provided.&lt;br /&gt;
** {{nbt|int|offsetX}}: An optional x offset to the location.&lt;br /&gt;
** {{nbt|int|offsetY}}: An optional y offset to the location.&lt;br /&gt;
** {{nbt|int|offsetZ}}: An optional z offset to the location.&lt;br /&gt;
** {{nbt|compound|predicate}}: Predicate applied to location, uses same structure as advancements.&lt;br /&gt;
*** {{nbt inherit/conditions/location|indent=***}}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot; id=&amp;quot;condition_match_tool&amp;quot; style=&amp;quot;margin-block-end: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;match_tool&amp;#039;&amp;#039;&amp;#039;&amp;amp;mdash;Checks tool used to mine the block. Requires &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;tool&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt; provided by [[Minecraft:loot context]], and always &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#d33&amp;quot;&amp;gt;fails&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt; if not provided.&lt;br /&gt;
** {{nbt|compound|predicate}}: Predicate applied to item, uses same structure as advancements.&lt;br /&gt;
*** {{nbt inherit/conditions/item|indent=***}}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot; id=&amp;quot;condition_random_chance&amp;quot; style=&amp;quot;margin-block-end: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;random_chance&amp;#039;&amp;#039;&amp;#039;&amp;amp;mdash;Generates a random number between 0.0 and 1.0, and checks if it is less than a specified value. Invokable from &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;any context&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt;.&lt;br /&gt;
** {{nbt|float}}{{nbt|compound|chance}}: A [[Minecraft:Loot table#Number provider|number provider]]. Success rate as a number 0.0&amp;amp;ndash;1.0.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot; id=&amp;quot;condition_random_chance_with_looting&amp;quot; style=&amp;quot;margin-block-end: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;random_chance_with_enchanted_bonus&amp;#039;&amp;#039;&amp;#039;&amp;amp;mdash;Generates a random number between 0.0 and 1.0, and checks if it is less than the value determined using the level of a given enchantment. Requires &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;&amp;lt;code&amp;gt;attacker&amp;lt;/code&amp;gt; entity&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt; provided by [[Minecraft:loot context]], and if not provided, the enchantment level is regarded as 0.&lt;br /&gt;
** {{nbt|float|unenchanted_chance}}: The success rate to use when the enchantment is not present; 0.0&amp;amp;ndash;1.0.&lt;br /&gt;
** {{nbt|float}}{{nbt|compound|enchanted_chance}}: [[Minecraft:level-based value]]. The success rate based on the level when then enchantment is present; 0.0&amp;amp;ndash;1.0.&lt;br /&gt;
** {{nbt|string|enchantment}}: {{json ref/enchantment}}. The enchantment whose level to use for the chance calculation. If the enchantment is not present, uses {{cd|0}} as level.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot; id=&amp;quot;condition_reference&amp;quot; style=&amp;quot;margin-block-end: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;reference&amp;#039;&amp;#039;&amp;#039;&amp;amp;mdash;Invokes a predicate file and returns its result. Invokable from &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;any context&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt;. Cannot be used in [[Minecraft:Enchantment_definition#Effect_components|enchantment definitions]].&lt;br /&gt;
** {{nbt|string|name}}: The [[Minecraft:resource location]] of the predicate to invoke. A cyclic reference causes a parsing failure.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot; id=&amp;quot;condition_survives_explosion&amp;quot; style=&amp;quot;margin-block-end: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;survives_explosion&amp;#039;&amp;#039;&amp;#039;&amp;amp;mdash;Returns success with {{cd|1 ÷ explosion radius}} probability. Requires &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;explosion radius&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt; provided by [[Minecraft:loot context]], and always &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;success&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt; if not provided.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot; id=&amp;quot;condition_table_bonus&amp;quot; style=&amp;quot;margin-block-end: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;table_bonus&amp;#039;&amp;#039;&amp;#039;&amp;amp;mdash;Passes with probability picked from a list, indexed by enchantment power. Requires &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;tool&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt; provided by [[Minecraft:loot context]]. If not provided, the enchantment level is regarded as 0.&lt;br /&gt;
** {{nbt|string|enchantment}}: [[Minecraft:Resource location]] of enchantment. &lt;br /&gt;
** {{nbt|list|chances}}: List of probabilities for enchantment power, indexed from 0.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot; id=&amp;quot;condition_time_check&amp;quot; style=&amp;quot;margin-block-end: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;time_check&amp;#039;&amp;#039;&amp;#039;&amp;amp;mdash;Compares the current day time (or rather, &amp;lt;code&amp;gt;24000 * day count + day time&amp;lt;/code&amp;gt;) against given values. Invokable from &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;any context&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt;.&lt;br /&gt;
** {{nbt|string|clock}}: {{json ref|world clock}} to check the time of.&lt;br /&gt;
** {{nbt|compound|value}}: The time to compare the day time against.&lt;br /&gt;
*** {{nbt|int}}{{nbt|compound|min}}: A [[Minecraft:Loot table#Number provider|number provider]]. The minimum value.&lt;br /&gt;
*** {{nbt|int}}{{nbt|compound|max}}: A [[Minecraft:Loot table#Number provider|number provider]]. The maximum value.&lt;br /&gt;
** {{nbt|int|value}}: Shorthand version of {{nbt|compound|value}} above, used to check for a single value only. Number providers cannot be used in this shorthand form.&lt;br /&gt;
** {{nbt|int|period}}: If present, the day time is first reduced modulo the given number before being checked against {{nbt|compound}}{{nbt|int|value}}. For example, setting this to 24000 causes the checked time to be equal to the current daytime.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot; id=&amp;quot;condition_value_check&amp;quot; style=&amp;quot;margin-block-end: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;value_check&amp;#039;&amp;#039;&amp;#039;&amp;amp;mdash;Compares a number against another number or range of numbers. Invokable from &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;any context&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt;.&lt;br /&gt;
** {{nbt|int}}{{nbt|compound|value}}: A [[Minecraft:Loot table#Number provider|number provider]]. The number to test.&lt;br /&gt;
** {{nbt|compound|range}}: The range of numbers to compare {{nbt|int}}{{nbt|compound|value}} against.&lt;br /&gt;
*** {{nbt|int}}{{nbt|compound|min}}: A [[Minecraft:Loot table#Number provider|number provider]]. The minimum value.&lt;br /&gt;
*** {{nbt|int}}{{nbt|compound|max}}: A [[Minecraft:Loot table#Number provider|number provider]]. The maximum value.&lt;br /&gt;
** {{nbt|int|range}}: Shorthand version of {{nbt|compound|range}} above, used to compare {{nbt|int}}{{nbt|compound|value}} against a single number only. Number providers cannot be used in this shorthand form.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot; id=&amp;quot;condition_weather_check&amp;quot; style=&amp;quot;margin-block-end: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;weather_check&amp;#039;&amp;#039;&amp;#039;&amp;amp;mdash;Checks the current game weather. Invokable from &amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:#00af89&amp;quot;&amp;gt;any context&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt;.&lt;br /&gt;
** {{nbt|boolean|raining}}: If true, the condition passes only if it is raining or thundering.&lt;br /&gt;
** {{nbt|boolean|thundering}}: If true, the condition passes only if it is thundering.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
{{HistoryTable&lt;br /&gt;
|{{HistoryLine|java}}&lt;br /&gt;
|{{HistoryLine||1.15|dev=19w38a|Added predicates to data packs.}}&lt;br /&gt;
|{{HistoryLine||1.16|dev=20w12a|Added fishing_hook sub-predicate into entity predicate to check properties of the fishing hook.}}&lt;br /&gt;
|{{HistoryLine||1.19|dev=22w14a|{{cd|player|fishing_hook|lightning_bolt|catType|d=and}} fields have been replaced with {{cd|type_specific}}. {{cd|type_specific}} has field {{cd|type}} (one of {{cd|player|fishing_hook|lightning_bolt|cat|d=or}}) and same sub-fields as removed fields.}}&lt;br /&gt;
|{{HistoryLine||1.19.3|dev=23w06a|Removed {{cd|d=and|is_projectile|is_explosion|bypasses_armor|bypasses_invulnerability|bypasses_magic|is_fire|is_magic|is_lightning}} fields from {{cd|damage_source_properties}}.|A new {{cd|tags}} array has been added to {{cd|damage_source_properties}}. Each entry has two fields:&lt;br /&gt;
* {{cd|id}}: The ID of a damage type tag.&lt;br /&gt;
* {{cd|expected}}: Whether the damage is expected to have or not have the tag for the predicate to match.}}&lt;br /&gt;
|{{HistoryLine||1.20|dev=23w18a|Condition {{cd|alternative}} has been renamed to {{cd|any_of}}.|Added new condition {{cd|all_of}} that passes only when all sub-conditions pass, with the same syntax as {{cd|any_of}}.}}&lt;br /&gt;
|{{HistoryLine||1.20.5|dev=24w09a|Item predicate format has been updated:&lt;br /&gt;
&lt;br /&gt;
*{{cd|tag}} field has been removed.&lt;br /&gt;
*{{cd|items}} field now supports a single entry, hash-prefixed item tag, or list of items.&lt;br /&gt;
*{{cd|potion}} renamed to {{cd|potions}}, and supports a single entry, hash-prefixed potion tag, or list of potions.&lt;br /&gt;
*{{cd|nbt}} predicate has been renamed to {{cd|custom_data}} and now matches {{cd|minecraft:custom_data}} component.&lt;br /&gt;
*A new optional {{cd|components}} field matches exact components.&lt;br /&gt;
|Block predicate format has been updated:&lt;br /&gt;
*{{cd|tag}} field has been removed.&lt;br /&gt;
*{{cd|blocks}} field now supports a single entry, hash-prefixed block tag, or list of blocks.&lt;br /&gt;
|Fluid predicate format has been updated:&lt;br /&gt;
*{{cd|tag}} field has been removed.&lt;br /&gt;
*{{cd|fluid}} renamed to {{cd|fluids}}, and supports a single entry, hash-prefixed fluid tag, or list of fluids.&lt;br /&gt;
|Entity predicate format has been updated:&lt;br /&gt;
*{{cd|type}} field now supports a single entry, hash-prefixed entity type tag, or list of entity types.&lt;br /&gt;
|Location predicate format has been updated:&lt;br /&gt;
*{{cd|biome}} renamed to {{cd|biomes}}, and supports a single entry, hash-prefixed biome tag, or list of biomes.&lt;br /&gt;
*{{cd|structure}} renamed to {{cd|structures}}, and supports a single entry, hash-prefixed structure tag, or list of structures.&lt;br /&gt;
}}&lt;br /&gt;
|{{HistoryLine|||dev=24w10a|Added entity sub-predicate {{cd|slots}}, used to check single or multiple slots on any entity.}}&lt;br /&gt;
|{{HistoryLine|||dev=24w11a|Removed entity sub-predicate {{cd|any}}&lt;br /&gt;
Component-specific item predicate properties have been moved to separate field {{cd|predicates}}|&lt;br /&gt;
Item sub-predicate format has been updated:&lt;br /&gt;
*Some fields from item predicate have been moved to a map in an optional field {{cd|predicates}}.&lt;br /&gt;
*{{cd|enchantments}}, {{cd|stored_enchantments}}, {{cd|potions}}, {{cd|custom_data}} fields have been moved to {{cd|minecraft:enchantments}}, {{cd|minecraft:stored_enchantments}}, {{cd|minecraft:potion_contents}}, {{cd|minecraft:custom_data}} sub-predicates respectively.&lt;br /&gt;
*{{cd|durability}} field has been expanded to {{cd|minecraft:damage}} predicate.&lt;br /&gt;
*Predicates {{cd|minecraft:enchantments}}, {{cd|minecraft:stored_enchantments}}, {{cd|minecraft:potion_contents}}, {{cd|minecraft:damage}} now require matching component to exist on them.}}&lt;br /&gt;
|{{HistoryLine||1.21|dev=24w18a|Renamed {{cd|random_chance_with_looting}} to {{cd|random_chance_with_enchanted_bonus}}, changing the {{cd|chance}} field from a float to a level-based value, removing the {{cd|looting_multiplier}} field, and adding a {{cd|enchantment}} field.|&lt;br /&gt;
Changed the {{cd|chance}} field of {{cd|random_chance}} from a float into a number provider.|&lt;br /&gt;
Added a {{cd|can_see_sky}} field to location predicates.|&lt;br /&gt;
Renamed {{cd|enchantment}} to {{cd|enchantments}} in the {{cd|minecraft:enchantments}} item sub-predicate; now accepting multiple possible enchantments, or tags.|&lt;br /&gt;
Changes to the entity predicate:&lt;br /&gt;
* added {{cd|is_on_ground}} and {{cd|is_flying}} flags to flags sub-predicate.&lt;br /&gt;
* added {{cd|movement}} sub-predicate.&lt;br /&gt;
* added {{cd|periodic_ticks}} sub-predicate.|&lt;br /&gt;
Renamed loot context entities: {{cd|killer}} renamed to {{cd|attacker}}; {{cd|direct_killer}} renamed to {{cd|direct_attacker}}; {{cd|killer_player}} renamed to {{cd|attacking player}}.}}&lt;br /&gt;
|{{HistoryLine|||dev=24w19a|Added {{cd|is_direct}} field to damage type predicates.}}&lt;br /&gt;
|{{HistoryLine|||dev=24w21a|Added {{cd|jukebox_playable}} item predicate.|&lt;br /&gt;
The {{cd|gamemode}} field of the player predicate now accepts a list of gamemodes rather than a single string.}}&lt;br /&gt;
|{{HistoryLine|||dev=pre1|Split {{cd|chance}} into {{cd|unenchanted_chance}} and {{cd|enchanted_chance}} in the {{cd|random_chance_with_enchanted_bonus}} condition.}}&lt;br /&gt;
|{{HistoryLine||1.21.2|dev=24w35a|New entity sub-predicate for testing sheep wool. Fields: &amp;lt;code&amp;gt;sheared&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;color&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
|{{HistoryLine|||dev=24w36a|New entity sub-predicate for testing player input. Available inputs to test are &amp;lt;code&amp;gt;forward&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;backward&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;left&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;right&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;jump&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;sneak&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;sprint&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
|{{HistoryLine|||dev=24w37a|New entity sub-predicate for salmon. Fields: &amp;lt;code&amp;gt;variant&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
|{{HistoryLine|||dev=24w39a|Removed the &amp;lt;code&amp;gt;minecraft:boat&amp;lt;/code&amp;gt; entity sub-predicate, since boats no longer have variants.}}&lt;br /&gt;
|{{HistoryLine||1.21.5|dev=25w03a|A new optional field was added to entity predicate: {{cd|components}}.|Several entity sub-predicates have been removed and replaced with combination of {{cd|components}} predicate and variant entity components.|The field {{cd|color}} has been removed from {{cd|minecraft:sheep}} sub-predicate.}}&lt;br /&gt;
|{{HistoryLine|||dev=25w07a|The {{cd|stepping_on}} entity predicate can only evaluate to {{cd|true}} if the entity is on ground.}}&lt;br /&gt;
|{{HistoryLine|||dev=25w10a|New optional fields have been added to block predicates: {{cd|components}} and {{cd|predicates}}.|A new optional field has been added to entity predicates: {{cd|predicates}}.}}&lt;br /&gt;
|{{HistoryLine||1.21.11|dev=25w41a|Component predicates (predicates field in block, item and entity predicates) now include predicates for checking existence of every component type.|The {{cd|flags}} entity predicate now supports new values.|Item predicate in command form (&amp;lt;code&amp;gt;&amp;lt;item&amp;gt;[predicate~{...},component={...}]&amp;lt;/code&amp;gt;) has been extended to accept empty predicates for any component type.}}&lt;br /&gt;
|{{HistoryLine||26.1|dev=snap1|{{cd|player}} Sub-Predicate has a new optional field: {{cd|food}}.}}&lt;br /&gt;
|{{HistoryLine|||dev=snap3|{{cd|minecraft:time_check}} loot predicate: added {{cd|clock}} field.}}&lt;br /&gt;
|{{HistoryLine|||dev=pre1|Added the {{cd|minecraft:environment_attribute_check}} loot predicate.}}&lt;br /&gt;
|{{HistoryLine|java upcoming}}&lt;br /&gt;
|{{HistoryLine||26.2|dev=snap3|The Entity predicate format has changed from a structure with multiple optional fields to one similar to data component maps.|Added {{cd|minecraft:entity_tags}} entity sub-predicate.}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Minecraft:Data pack]] – where predicates are defined and stored&lt;br /&gt;
* [[Minecraft:Loot table]] – one of the most common predicate users&lt;br /&gt;
* [[Minecraft:Advancement]] – another system that embeds predicates&lt;br /&gt;
* [[Minecraft:Execute]] – command subcomponent that can run predicates&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [https://misode.github.io/predicate/ Predicate Generator on misode.github.io]&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
{{Navbox Java Edition technical|datapack}}&lt;br /&gt;
&lt;br /&gt;
[[Minecraft:de:Prädikate]]&lt;br /&gt;
[[Minecraft:fr:Prédicat]]&lt;br /&gt;
[[Minecraft:ja:プレディケート]]&lt;br /&gt;
[[Minecraft:pt:Predicado]]&lt;br /&gt;
[[Minecraft:zh:谓词]]&lt;/div&gt;</summary>
		<author><name>SyncBot</name></author>
	</entry>
</feed>