Trying to use this command (while within a wheat block) to detect whether a wheat block is at age 7:
/execute if predicate {condition:"minecraft:block_state_property",block:"minecraft:wheat",properties:{age:"7"}} run tellraw @a "hi"
and it doesn’t work. Nothing is printed in the chat.
If I try this command instead, it does work:
/execute if block ~ ~ ~ wheat[age="7"] run tellraw @a "hi"
A location_check
predicate also works:
/execute if predicate {condition:"minecraft:location_check",predicate:{block:{blocks:"wheat",state:{age:"7"}}}} run tellraw @a "hi"
So the problem seems to be with the block_state_property
predicate. I attached a video showing me using these commands.
Environment
Minecraft Java Edition 1.21.7
The
block_state_property
condition requires the loot context parameter "block state" in order to succeed. This can be provided by:A loot table of type
block
orblock_interact
An advancement with trigger
allay_drop_item_on_block
,any_block_use
,default_block_use
,item_used_on_block
orplaced_block
An enchantment with component
hit_block
The only loot context parameters provided by
/execute if predicate
are "origin" and "this entity".