0

I want to test for Items in the Item frame, so I setup this command:

testfor @e[type=ItemFrame] {TileX:-322,TileY:57,TileZ:-61,Item:{id:minecraft:lever},ItemRotation:5b}

The lever is a key that you put into the Item Frame and turn it to activate redstone signal. However, I want to test for a unique item, and not any spawned in lever. I know about UUIDMost, and UUIDLeast from Attribute Modifiers, but I do not know how to use them.

2

Items don't, by default, have any identifying feature that would separate them from another item of the same type. You can swap the position of two levers around in your inventory and your inventory will be in the exact same state.

If you want to test that a specific lever is in the frame, you'll need to make something about it unique. For example, you could give the item you want to test for unique Lore:

/give @p lever 1 0 {display:{Lore:["Key"]}}

And then test for it like this;

/testfor @e[type=ItemFrame,x=-322,y=57,z=-61,r=0] {Item:{id:minecraft:lever,tag:{display:{Lore:["Key"]}}},ItemRotation:5b}
  • I made a hashed lore so it is harder to forge from creative mode ;) – John Smith Oct 1 '15 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.