If you're trying to detect identical items, you could use the selector
/testfor @e[c=1,type=Item] {NBT}
This will only select one item (the closest, I believe). You could then use the scoreboard to tag/mark the item and do another search which excludes that item. If you are detecting the same item, but can differentiate them, such as different custom names, enchants, stacksize, etc. you can get those values via NBT. Refer to the Wiki page on NBT format for more info on the differnt tags you can use, and how to get to them.
My first recommendation would be to use a different method of running three commands. Two other possibilities you could use are chained command blocks or a function. If you absolutely need it in one command block then use a function, otherwise, use a chain of command blocks as it is simpler. To do the latter, place three command blocks next to each other so that they point into each other. Then when putting commands into the final two blocks, click the buttons below until they say Chain / Conditional / Always Active.
If you still want to use the falling block method, there are several problems that I see with your command.
You used escaped quotation marks(\”
) which are not needed in this case and cause a problem. You also used the wrong kind of quotation marks (”
vs "
)
You used the @s
target selector which targets the entity executing the command. The command block would output Entity '@s' cannot be found
. You will have to use an appropriate target selector. You could use @p
to target the player nearest the command blocks.
The first use of Passengers
(Passengers [{id:falling_block
) is missing :
.
The last command block command fill ~ ~-5 ~-1 ~~50 ~-1 redstone_block
has no space between x2 and y2(~~50
should be ~ ~50
). Also, the redstone blocks only need to be next to the blocks that need to be activated. With the current coordinates, you are producing a stack from one below the original command block, all the way to 50 above the last command block. I changed the fill coordinates to ~ ~-3 ~-1 ~ ~-1 ~-1
and it only puts the blocks where they are needed.
Another change. While it is not required to be changed, command block commands do not need to start with /
With all of these changes the command is:
summon falling_block ~ ~1 ~ {Block:command_block,Time:1,TileEntityData:{Command:"give @p minecraft:bow 1"},Passengers:[{id:falling_block,Block:command_block,Time:1,TileEntityData:{Command:"give @p minecraft:arrow 64"},Passengers:[{id:falling_block,Block:command_block,Time:1,TileEntityData:{Command:"tp @p 384.700 7 400.700"},Passengers:[{id:falling_block,Block:command_block,Time:1,TileEntityData:{Command:"fill ~ ~-3 ~-1 ~ ~-1 ~-1 redstone_block"},Passengers:[{id:falling_block,Block:redstone_block,Time:1}]}]}]}]}
Note:This will only successfully run one time. After that, the command blocks and redstone blocks are already in place so if you run it again, it will cause command blocks and redstone blocks to break and be dropped as items.
You could correct this by removing all of the command blocks and redstone blocks that were created by the original command block. Either manually or with another command block.
Best Answer
According to the Minecraft wiki, there is no way to create multiple types of items using one /give command. You can spawn falling command blocks to achieve a very similar effect, but the command is so long that it can't be started from chat. You might be able to put this command in a command block and use
setblock
to trigger it.summon falling_block ~ ~2 ~ {Time:1,BlockState:{Name:"command_block"},TileEntityData:{auto:1,Command:"/give @a diamond 1"},Passengers:[{id:"armor_stand",Health:0,Passengers:[{id:"falling_block",Time:1,BlockState:{Name:"command_block"},TileEntityData:{auto:1,Command:"/give @a gold_ingot 1"},Passengers:[{id:"armor_stand",Health:0,Passengers:[{id:"falling_block",Time:1,BlockState:{Name:"command_block"},TileEntityData:{auto:1,Command:"fill ~ ~-2 ~ ~ ~ ~ air"}}]}]}]}]}