1

I want to make a shop where the player must hold a item and then click a button, and what I want to do is a "test for" like command to check if the item in the players hand matches the item in slot 0 in the chest. Is there a way to do that thanks.

or I could just check if the item is in the players inventory. :)

  • It seems this user found how to testfor the chest and posted a separate question here – Judge2020 Aug 28 '15 at 21:45
  • @Judge2020 your link is pointing to this question, you might want to look into that. – Lars Oct 23 '15 at 13:57
1

You cannot compare the two items in the sense of

Chest == Hand

However you can do something more like

Chest == X and Hand == X therefor Chest == Hand

You can check what is in the hand using {SelectedItem:{Item Tag}} (see more at http://minecraft.gamepedia.com/Player.dat)

0

No, you cannot compare items in inventories. You probably want to check for the specific item in the command.

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.