Check the block connected that an item frame is connected to



  • 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.



  • 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
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2