Block predicate
A block predicate is a test for the state of a block at a given position in the world. They are used by placement modifiers in placed features, numerous configured features, and enchantments.
JSON Format
Block predicated are defined using the following format:
- [NBT Compound / JSON Object]: a block predicate
- [String] type: The type of the block predicate. See Block predicate § Types for options.
- additional fields depending on [String] type. See Block predicate § Types.
Types
The following block predicate types exist:
true
Always matches, independent of the block.
- [NBT Compound / JSON Object]: a block predicate
- [String] type:
true
- [String] type:
all_of
Combined multiple block predicates. Matches if all specified block predicates match.
- [NBT Compound / JSON Object]: a block predicate
- [String] type:
all_of - [NBT List / JSON Array] predicates: (Can be empty) The child predicates.
- [NBT Compound / JSON Object]: A block predicate.
- [String] type:
any_of
Combined multiple block predicates. Matches if at least one of the specified block predicates matches.
- [NBT Compound / JSON Object]: a block predicate
- [String] type:
any_of - [NBT List / JSON Array] predicates: (Can be empty) The child predicates.
- [NBT Compound / JSON Object]: A block predicate.
- [String] type:
not
Inverts a given block predicate. Matches if the specified other block predicate does not match.
- [NBT Compound / JSON Object]: a block predicate
- [String] type:
not - [NBT Compound / JSON Object] predicate: The block predicate to invert.
- [String] type:
has_sturdy_face
Checks if the block at the specified offset has a full block supporting surface in the specified direction.
- [NBT Compound / JSON Object]: a block predicate
- [String] type:
has_sturdy_face - [NBT List / JSON Array] offset: (optional, defaults to [0,0,0]) A list of 3 integers specifying an [X, Y, Z] block position offset to check.
- [Int]: Value between -16 and 16 (inclusive).
- [String] direction: The direction of the block to check if it is sturdy.
- [String] type:
inside_world_bounds
Checks if the positions y-level (with specified offset) is within the height limits of the world.
- [NBT Compound / JSON Object]: a block predicate
- [String] type:
inside_world_bounds - [NBT List / JSON Array] offset: (optional, defaults to [0,0,0]) A list of 3 integers specifying an [X, Y, Z] block position offset to check.
- [Int]: Value between -16 and 16 (inclusive).
- [String] type:
matching_block_tag
Checks if the block at the specified offset is in the given block tag.
- [NBT Compound / JSON Object]: a block predicate
- [String] type:
matching_block_tag - [NBT List / JSON Array] offset: (optional, defaults to [0,0,0]) A list of 3 integers specifying an [X, Y, Z] block position offset to check.
- [String] tag: The block tag without
#to check for.
- [String] type:
matching_blocks
Checks if the block at the specified offset is one of the specified blocks.
- [NBT Compound / JSON Object]: a block predicate
- [String] type:
matching_blocks - [NBT List / JSON Array] offset: (optional, defaults to [0,0,0]) A list of 3 integers specifying an [X, Y, Z] block position offset to check.
- [String][NBT List / JSON Array] blocks: Any number of block(s) (an [String] ID, or a [String] tag with
#, or an [NBT List / JSON Array] array containing [String] IDs) that will match.
- [String] type:
matching_fluids
Checks if the fluid at the specified offset is one of the specified fluid.
- [NBT Compound / JSON Object]: a block predicate
- [String] type:
matching_fluids - [NBT List / JSON Array] offset: (optional, defaults to [0,0,0]) A list of 3 integers specifying an [X, Y, Z] block position offset to check.
- [String][NBT List / JSON Array] fluids: Any number of fluid(s) (an [String] ID, or a [String] tag with
#, or an [NBT List / JSON Array] array containing [String] IDs) that will match.
- [String] type:
replaceable
Checks if the block at the specified offset can be replaced by placing blocks.
- [NBT Compound / JSON Object]: a block predicate
- [String] type:
replaceable - [NBT List / JSON Array] offset: (optional, defaults to [0,0,0]) A list of 3 integers specifying an [X, Y, Z] block position offset to check.
- [Int]: Value between -16 and 16 (inclusive).
- [String] type:
solid
Checks if the block at the specified offset is solid.
- [NBT Compound / JSON Object]: a block predicate
- [String] type:
solid - [NBT List / JSON Array] offset: (optional, defaults to [0,0,0]) A list of 3 integers specifying an [X, Y, Z] block position offset to check.
- [Int]: Value between -16 and 16 (inclusive).
- [String] type:
would_survive
Checks if a specified block state is a valid placement at the given offset.
- [NBT Compound / JSON Object]: a block predicate
- [String] type:
would_survive - [NBT List / JSON Array] offset: (optional, defaults to [0,0,0]) A list of 3 integers specifying an [X, Y, Z] block position offset to check.
- [Int]: Value between -16 and 16 (inclusive).
- [NBT Compound / JSON Object] state: The blockstate to test.
- Block state see Template:Nbt inherit/block state/template
- [String] type:
| |||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||