1

I'm trying to check the inventory of a hopper that has an item frame connecting to it, however I can't even get it to say "hi". I currently have this:

execute as @e[type=minecraft:item_frame,nbt={Item:{id:"minecraft:iron_ingot"},Facing:5b}] run execute if data block ~-1 ~ ~ minecraft:hopper run say Hi

If I run the following it says "hi":

execute as @e[type=minecraft:item_frame,nbt={Item:{id:"minecraft:iron_ingot"},Facing:5b}] run say hi

so I know it's targeting the item frame. The item frame is facing west so I minus 1 from the x to try to get the hopper but then nothing runs.

2 Answers 2

2

I had to change the command from execute as to execute at

execute at @e[type=minecraft:item_frame,nbt={Item:{id:"minecraft:iron_ingot"},Facing:5b}] run execute if data block ~-1 ~ ~ minecraft:hopper run say Hi
2

Command that works regardless of the direction of the item frame:

execute as @e[type=minecraft:item_frame,nbt={Item:{id:"minecraft:iron_ingot"}}] at @s if block ^ ^ ^-1 minecraft:hopper run say hi
1
  • Omg thanks for sharing this. This will cut my code right down
    – Tom Hanson
    Apr 20 at 14:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .