Predicate & Condition Builder

Build datapack predicate JSON with entity, location, and item conditions — combine multiple with AND/OR/NOT.

Add one or more conditions below, then combine them into a single predicate JSON. With one condition, the JSON is that condition alone; with two or more, it is wrapped in the combinator you pick.

Predicate JSON


  

Save this as data/<namespace>/predicate/<name>.json, then reference it by <namespace>:<name> in a loot table’s "conditions":[…] or in an advancement criterion.

Matches the real Minecraft data-driven predicate JSON schema — verify condition-specific fields against your target version, some predicate types have changed between versions.

Quick guides

How to use this tool, and the questions players ask most.

What is a predicate in a Minecraft datapack?

A predicate is a JSON condition file that returns true or false when evaluated by the game. Datapacks evaluate them using the execute if predicate &lt;namespace&gt;:&lt;name&gt; command to run logic based on weather, biomes, or entity states.

Where are predicate files stored in a datapack?

Predicates are saved as .json files inside the data/&lt;namespace&gt;/predicates/ directory of your datapack. In Minecraft 1.21, the game registers these files automatically when you load the world or execute the /reload command.

How do you test a predicate in a command?

Test a predicate by running /execute if predicate &lt;namespace&gt;:&lt;name&gt; run &lt;command&gt;. You can also invert the result using execute unless predicate &lt;namespace&gt;:&lt;name&gt; to trigger commands only when the condition returns false.

How do you combine multiple conditions with AND or OR?

Combine conditions by nesting them inside an all_of array for AND logic or an any_of array for OR logic. The Predicate & Condition Builder formats these compound condition arrays and handles logical nesting automatically.

Can a predicate detect what item a player holds?

Yes, predicates use the minecraft:entity_properties condition with the equipment.mainhand field to inspect held items. This checks for exact item IDs like minecraft:diamond_sword as well as custom component data on the item.

More on 9Minecraft

Other tools on 9Minecraft you may find useful.

More Data Packs tools

Other tools on 9Minecraft you may find useful.