How can I make a command be triggered when an item is throwed?

How can I make a command be triggered when an item is throwed? - Dirty throwing wheels in modern workshop

I would like to have a command that makes a item that when I throw it will freeze mobs for 100 s in a 200 block area (trigger a command). how can I do this?



Best Answer

Have the following commands repeating, in this order:

/scoreboard players tag @e[type=Item] add FreezeItem {Item:{id:"minecraft:ice",tag:{display:{Name:"Freeze"}}}}
/execute @e[type=Item,tag=FreezeItem] ~ ~ ~ /effect @e[type=!Player,r=200] slowness 100 50
/kill @e[type=Item,tag=FreezeItem]

You can change {Item:{id:"minecraft:ice",tag:{display:{Name:"Freeze"}}}} to the tags you want to identify the item by. Currently, it's a block of ice renamed "Freeze".

You can also change /effect @e[type=!Player,r=200] slowness 100 50 to whatever command you want to activate when the item is thrown.




Pictures about "How can I make a command be triggered when an item is throwed?"

How can I make a command be triggered when an item is throwed? - Young skilled female ceramist wearing light apron throwing clay ball while making ceramic products in modern workshop
How can I make a command be triggered when an item is throwed? - Old tools on wooden surface
How can I make a command be triggered when an item is throwed? - A Person Buying From a Grocery



How do you trigger a command block with an item?

You can use the /trigger command to create a trigger that sets or adds values to scoreboard objectives that trigger enabled in Minecraft....Definitions
  • objective is the name of the objective that will be set or add a value to.
  • setValue is the value to set the objective to.
  • addValue is the amount added to the objective.




  • How to trigger commands dropping items in Minecraft Bedrock




    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: Anete Lusina, Monstera, Elijah O'Donnell, Julia Avamotive