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_propertycondition requires the loot context parameter "block state" in order to succeed. This can be provided by:A loot table of type
blockorblock_interactAn advancement with trigger
allay_drop_item_on_block,any_block_use,default_block_use,item_used_on_blockorplaced_blockAn enchantment with component
hit_blockThe only loot context parameters provided by
/execute if predicateare "origin" and "this entity".