Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Block predicate: Difference between revisions

From SAS Gaming Wiki
SyncBot (talk | contribs)
Sync: updated from Minecraft
SyncBot (talk | contribs)
Sync: updated from Minecraft
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{about|the system used by features and enchantments|the similar system used by advancements|predicate}}
{{about|the system used by worldgen features and enchantments|the similar system used by advancements|predicate}}
{{exclusive|java}}
{{exclusive|java}}


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 [[Minecraft:placed feature]]s, numerous [[Minecraft:configured feature]]s, and [[Minecraft:enchantment definition|enchantments]].
A '''block predicate''' (also known as a '''placement condition''') is a test for the state of a block at a given position in the world. They are used by placement modifiers in [[Minecraft:placed feature]]s, numerous [[Minecraft:configured feature]]s, and [[Minecraft:enchantment definition|enchantments]].


== JSON Format ==
== JSON Format ==
Line 44: Line 44:


=== height_range ===
=== height_range ===
Checks the height of the position against a given range.{{upcoming|JE 26.3}}
Checks the height of the position against a given range.


<div class="treeview">
<div class="treeview">
Line 60: Line 60:
** {{nbt|list|offset}}: (optional, defaults to [0,0,0]) A list of 3 integers specifying an [X, Y, Z] block position offset to check.
** {{nbt|list|offset}}: (optional, defaults to [0,0,0]) A list of 3 integers specifying an [X, Y, Z] block position offset to check.
*** {{nbt|int}}: Value between -16 and 16 (inclusive).
*** {{nbt|int}}: Value between -16 and 16 (inclusive).
</div>
=== matching_biomes ===
Checks if the biome at the position is one of the specified biomes.
<div class="treeview">
* {{nbt|compound}}: a block predicate
** {{nbt|string|type}}: <code>matching_biomes</code>
** {{nbt|string}}{{nbt|list|biomes}}: {{json_ref|biome|tag=1|tag_link=biome tag (Java Edition)}} that will match.
</div>
</div>


Line 87: Line 95:
** {{nbt|list|offset}}: (optional, defaults to [0,0,0]) A list of 3 integers specifying an [X, Y, Z] block position offset to check.
** {{nbt|list|offset}}: (optional, defaults to [0,0,0]) A list of 3 integers specifying an [X, Y, Z] block position offset to check.
** {{nbt|string}}{{nbt|list|fluids}}: {{json_ref|fluid|tag=1|tag_link=fluid tag (Java Edition)}} that will match.
** {{nbt|string}}{{nbt|list|fluids}}: {{json_ref|fluid|tag=1|tag_link=fluid tag (Java Edition)}} that will match.
** {{nbt|compound|state}}{{upcoming|JE 26.4}}: A map of name-value properties to be matched against the fluid state properties. The value can be an integer, boolean, string, or an object with optional {{cd|min}} and {{cd|max}} properties.
</div>
</div>


Line 122: Line 131:
* {{nbt|compound}}: a block predicate
* {{nbt|compound}}: a block predicate
** {{nbt|string|type}}: <code>true</code>
** {{nbt|string|type}}: <code>true</code>
</div>
=== unobstructed ===
Checks if the position (with the specified offset) is unobstructed (no block collision).
<div class="treeview">
* {{nbt|compound}}: a block predicate
** {{nbt|string|type}}: <code>unobstructed</code>
** {{nbt|list|offset}}: (optional, defaults to [0,0,0]) A list of 3 integers specifying an [X, Y, Z] block position offset to check.
</div>
=== volume_match ===
Checks that every block within a volume, defined by minimum and maximum offsets, matches the given block predicate.
<div class="treeview">
* {{nbt|compound}}: a block predicate
** {{nbt|string|type}}: <code>volume_match</code>
** {{nbt|list|min}}: A list of 3 integers specifying the minimum [X, Y, Z] offset of the volume.
*** {{nbt|int}}: Value between -16 and 16 (inclusive).
** {{nbt|list|max}}: A list of 3 integers specifying the maximum [X, Y, Z] offset of the volume.
*** {{nbt|int}}: Value between -16 and 16 (inclusive).
** {{nbt|compound|match}}: The block predicate that must match at every position in the volume.
</div>
</div>


Line 139: Line 168:
{{info needed section|general history of block predicates. Specifically, when block predicates were added or removed.}}
{{info needed section|general history of block predicates. Specifically, when block predicates were added or removed.}}
{{HistoryTable
{{HistoryTable
|{{HistoryLine|upcoming java}}
|{{HistoryLine|java}}
|{{HistoryLine||26.3|dev=snap2|Added {{cd|minecraft:height_range}}.}}
|{{HistoryLine||26.3|dev=snap2|Added {{cd|minecraft:height_range}}.}}
|{{HistoryLine|||dev=snap8|Added {{cd|minecraft:volume_match}}.}}
|{{HistoryLine|java upcoming}}
|{{HistoryLine||26.4|dev=snap4|{{cd|minecraft:matching_fluids}}: Added the {{cd|state}} field.}}
}}
}}


Line 146: Line 178:
{{Navbox Java Edition technical|datapack}}
{{Navbox Java Edition technical|datapack}}


[[Minecraft:de:Block-Prädikate]]
[[Minecraft:fr:Génération du monde personnalisée/Prédicat de bloc]]
[[Minecraft:fr:Génération du monde personnalisée/Prédicat de bloc]]
[[Minecraft:ja:ワールド生成のカスタマイズ/block predicate]]
[[Minecraft:ja:ワールド生成のカスタマイズ/block predicate]]
[[Minecraft:pt:Geração de mundo personalizado/predicado de bloco]]
[[Minecraft:pt:Geração de mundo personalizado/predicado de bloco]]
[[Minecraft:zh:编码格式/Worldgen#方块谓词]]
[[Minecraft:zh:编码格式/Worldgen#方块谓词]]

Latest revision as of 11:07, 14 October 2026

Template:Exclusive

A block predicate (also known as a placement condition) is a test for the state of a block at a given position in the world. They are used by placement modifiers in Minecraft:placed features, numerous Minecraft:configured features, and enchantments.

JSON Format

Block predicates are defined using the following format:

Types

The following block predicate types exist:

all_of

Combined multiple block predicates. Matches if all specified block predicates match.

any_of

Combined multiple block predicates. Matches if at least one of the specified block predicates matches.

has_sturdy_face

Checks if the block at the specified offset has a full block supporting surface in the specified direction.

  • Template:Nbt: a block predicate
    • Template:Nbt: has_sturdy_face
    • Template:Nbt: (optional, defaults to [0,0,0]) A list of 3 integers specifying an [X, Y, Z] block position offset to check.
    • Template:Nbt: The direction of the block to check if it is sturdy.

height_range

Checks the height of the position against a given range.

inside_world_bounds

Checks if the positions y-level (with specified offset) is within the height limits of the world.

  • Template:Nbt: a block predicate
    • Template:Nbt: inside_world_bounds
    • Template:Nbt: (optional, defaults to [0,0,0]) A list of 3 integers specifying an [X, Y, Z] block position offset to check.

matching_biomes

Checks if the biome at the position is one of the specified biomes.

matching_block_tag

Checks if the block at the specified offset is in the given block tag.

matching_blocks

Checks if the block at the specified offset is one of the specified blocks.

matching_fluids

Checks if the fluid at the specified offset is one of the specified fluid.

not

Inverts a given block predicate. Matches if the specified other block predicate does not match.

replaceable

Checks if the block at the specified offset can be replaced by placing blocks.

solid

Checks if the block at the specified offset is solid.

true

Always matches, independent of the block.

unobstructed

Checks if the position (with the specified offset) is unobstructed (no block collision).

  • Template:Nbt: a block predicate
    • Template:Nbt: unobstructed
    • Template:Nbt: (optional, defaults to [0,0,0]) A list of 3 integers specifying an [X, Y, Z] block position offset to check.

volume_match

Checks that every block within a volume, defined by minimum and maximum offsets, matches the given block predicate.

  • Template:Nbt: a block predicate
    • Template:Nbt: volume_match
    • Template:Nbt: A list of 3 integers specifying the minimum [X, Y, Z] offset of the volume.
    • Template:Nbt: A list of 3 integers specifying the maximum [X, Y, Z] offset of the volume.
    • Template:Nbt: The block predicate that must match at every position in the volume.

would_survive

Checks if a specified Minecraft:block state is a valid placement at the given offset.

History

Template:Info needed section Template:HistoryTable

Navigation

Template:Navbox Java Edition technical

Minecraft:de:Block-Prädikate Minecraft:fr:Génération du monde personnalisée/Prédicat de bloc Minecraft:ja:ワールド生成のカスタマイズ/block predicate Minecraft:pt:Geração de mundo personalizado/predicado de bloco Minecraft:zh:编码格式/Worldgen#方块谓词