I'm creating an adventure map for Minecraft and I need to use the /execute command with command blocks to detect when a player has thrown a Bottle O' Enchanting (Exp Bottle). If that has happened, the command teleports the player to the coordinates 0 0 0
.
I tried the following command but it didn't work: /execute @e[type=ThrownExpBottle] ~ ~ ~ tp @p 0 0 0
Best Answer
Your command is working perfectly fine. Make sure it runs on a clock!
It has a couple flaws though:
But here is an alternative solution, that is more reliable and multiplayer friendly!
The first thing you need to do, is to set up a scoreboard achievement: (type this in chat)
This will count the number of times a player has thrown an experience bottle.
The next thing you want to do is to build a clock that activates a command block with the following command:
That is going to teleport all the players that have thrown an experience bottle to the specified coordinates (replace x, y and z).
Now, place a comparator facing away from that command block, into a new one with this command:
That will reset the objective, so that you only get teleported once.