1

I want to make a command that check how many and what type of items are in a chest and then it will give 12 end portal frames to the nearest player.
I have tried with redstone but it is too big.
The idea is that the player comes to the chest and put in some specific items in a specific order (see image below).
It will then empty the chest give the 12 end portal frames to the player.
This is for a chunk challenge map.

enter image description here

  • 1 last thing that i forgot i will still continue to making my map and if i don't find a way to add this chest i just add a new chunk with the ende portal and tell the player where it is but i think that the way with the chest is more challenging for the player – Alex Nov 10 '16 at 18:17
4

You can use /testforblock:

/testforblock X Y Z chest -1 <blockdata>

Is something you'll probably understand, depending on your command block experience. If you don't:

X Y Z should be replaced with the coordinates of the chest. "chest" means the command block only returns a success when it's a chest. -1 means it can be any data value, in a chest's case this means any rotation.

Now for the harder part, you should add the blockdata testing:

/testforblock X Y Z chest -1 {Items:[{Slot:*ID*,id:*ID*,Count:1}]}

The slot IDs are numbered from left to right, top to bottom, starting with 0. This means the top left is 0, top right is 8, bottom right is 26.

Item IDs can be found by pressing F3 and H at the same time (which reveals advanced tooltips) and hovering over the item in your inventory. An emerald, for example, would be "minecraft:emerald".

The count part can be anything you like, although I think you'll want it to stay at 1.

And then there's one last thing to do: add a comparator running out of the command block, into a command block that replaces the chest with an empty one, and one that gives the nearest player the frames.

To make filling in the blockdata easier, I recommend this. Just select the /blockdata command, fill in all the slots, then copy the part between curly brackets into your /testforblock command.

| improve this answer | |
1

ok first one thanks for the help and second i made the command that will empty the chest but i have problems with the command that will check when the item is in the chest here is 2 pictures with what i did http://prnt.sc/d5vrq7 - http://prnt.sc/d5vryv both the repeating command blocks have this command /testforblock -1402 51 -895 chest -1 {Items:[{Slot:0,id:emerald,Count:1}]} which theoretically it will chek the chest for the emerald and both the chain and impulse command block have this command /blockdata -1402 51 -895 {Items:[{Slot:0,id:air,Count:1}]} which it will replace the chest with air this command works but for some reason the /testforblock command dosn't activate i can't make it work with the comparator so i used a chain command block but nothing and all the command blocks are in always active mode exept impulse command block

| improve this answer | |
  • 1
    The only issue I can think of here is not setting the command blocks to always active... – QunSyBer Nov 11 '16 at 21:13
  • well all of them are in always active maybe it's a letter that i miss and didn't work anyway since i could made this iv made a villager that trade the 12 frames thanks anyway – Alex Nov 12 '16 at 22:26

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.