Skip to main content

How to check for items in an item frame?

Comments

10 comments

  • Debbie Alexander
    Moderator Beacon of Knowledge Super Star

    So you want the door to be open at all times after the bread item had been placed in a certain frame? 

    ISTM you need to lay this out a little more. If there is a certain frame that is going to hold certain items, and at some times, players will place bread there, and then place that frame in a certain location, then an iron door will be open? Is that what you are looking for?

    0
  • Juanay Hauptfleisch

    Hi

    Yes. When the player places like example a bread item in the item frame, then it activates the redstone and opens the door.

    I want to use command blocks to prevent players from using other items like example books.

    I will post some screenshots

    0
  • Juanay Hauptfleisch

    Example like this

    0
  • Juanay Hauptfleisch

    I noticed if I use the following command in the text field

    "/testfor @e[type=item,name=bread]" it works

    but if I use the same command in the command block, it gives me there "no target selected error"

    any idea why?

    0
  • Debbie Alexander
    Moderator Beacon of Knowledge Super Star

    try adding a range parameter inside the brackets like r=3

    0
  • Juanay Hauptfleisch

    Does the bread become a block when placed in the item frame, like does the id change?

    The r=3 is working, but it is not picking up the bread in the item frame and keeps giving me the "No targets matched selector" error

    command is: /testfor @e[type=minecraft:item, name=item.bread.name, r=5, x=7, y=-59, z=31]

    0
  • Debbie Alexander
    Moderator Beacon of Knowledge Super Star

    I'm thinking that you have to test for a frame with the attribute that it contains bread, but I don't know commands for that. Dan Noble or Micah-M is there a chat level command that tests frames and distinguishes between one item and the next being put in it?

    On the other hand, Juanay Hauptfleisch there is an old saying among programmers;

    "If at first you don't succeed, redefine success." Perhaps redefining success in this case could just mean placing something in a spot instead. =]

    0
  • Juanay Hauptfleisch

    Thank you for your assistance. I will use a different command to build the activity. It would be a good feature to have in the Minecraft Education Edition to test for items in an item frame.

    1
  • Micah M
    Beacon of Knowledge

    Our world designer recommended using the /testforblocks command to check the player's item frame matches with an item frame you've hidden in the world that contains the "correct answer" (item frame with bread). Typically, the hidden comparison block would be put in your control room near where your command blocks are.

    1
  • Juanay Hauptfleisch

    Thank you so much for your help!

    I used /testfor command with hasitem for now. I will test the /testforblocks command in a seperate map.

    0

Please sign in to leave a comment.