What is the command that triggers another command when a specific item is thrown
The outcome needed is: when a player throws a specific item at a specific block, it triggers a command. Does anyone know how to do it? I have tried and I am unable to figure it out.
Best Answer
If you want to open a door when a flint is thrown on it, you first have to determinate if thrown item has the wanted type.
Detecting that an item is on a door block would be a little tricky, so you could simply use a trigger block.
To do that, you just have to use a scoreboard objective (replace OBJECTIVE by your objective's name) :
/scoreboard players set @e[type=Item] OBJECTIVE 1 {Item:{id:flint}}
This command must be placed into a clock. It will set a score of 1 to the wanted items.
And then execute the following command on all items with a score of 1 to determinate if the item is on a specific block and to execute another command (here, we are assuming that bedrock is your trigger block) :
/execute @e[score_OBJECTIVE=1] ~ ~ ~ testforblock ~ ~-1 ~ bedrock
Put that command on a clock too and get its output by using a comparator. If the comparator is powered, it means that the wanted item was found on the wanted block.
So, put that command at the output of the comparator :
/setblock torch_coords redstone_torch
This command is going to put a torch next to the door (replace torch_coords by torch coordinates — those coordinates can be relative).
And, by using a redstone NOT gate, put another command to close door when the item is picked up :
/setblock torch_coords air 0 replace simply replaces redstone torch by air, thus removing it.
Pictures about "What is the command that triggers another command when a specific item is thrown"



How do you trigger a command block with an item?
2. Armor standHow do you activate a command with an item?
The TRIGGER command associates a previously-created program to an object and identifies the object event that automatically executes the program; or a disassociates a trigger program from the object.How to trigger commands dropping items in Minecraft Bedrock
More answers regarding what is the command that triggers another command when a specific item is thrown
Answer 2
If you want to make that, you got to do this , first you got to make a objective, by using the command:
- /scoreboard objectives add FlintDoor dummy
Then you got to set the score to 1 for every flint in the world by using this command:
- /scoreboard players set @e[type=Item] FlintDoor 1 {Item:{id:flint}}
Then you detect or a Item with objective score (FlintDoor) 1 is in front of the door, how you do this is by using a command. But you will need to put another command after the execute/detect command , You want to open the door so you can set a redstone torch 2 blocks underneath the door , or You can set a Redstone block 1 block above or 1 block underneath the door, so you want to put this command in the last command block:
- /execute @e[score_FlintDoor=1] ~F ~ ~G detect ~ ~-1 ~ your_block 0 /setblock x y z redstone_torch 0 replace
Or with a redstone block
- /execute @e[score_FlintDoor=1] ~F ~ ~G detect ~ ~-1 ~ your_block 0 /setblock x y z redstone_block 0 replace
You will need to put the second and third or fourth command in a command block clock, if you need more help with them.
, it will work for 1.8. And you have to replace the x y z in the third and fourth command by the x y z of the blocks, If you need help with that use this . You will also have to change the F and G , there are a few combinations:- F=0,G=1
- F=0,G=-1
- F=1,G=0
- F=-1,G=0
- F=0,G=0
I hope this was helpful if you need more help just ask. Cyaa, Gl! :D
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Ivan Babydov, Ivan Babydov, Anete Lusina, Blue Bird
