Your command is working perfectly fine. Make sure it runs on a clock!
It has a couple flaws though:
- not multiplayer friendly: You would teleport every player, once a
bottle is in the air
- suspended player: The player will not
be able to move until the bottle hits the ground, as you're constantly teleporting him. This is especially bad if you happen to throw a bottle down a high cliff.
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)
/scoreboard objectives add ExpThrown stat.useItem.minecraft.experience_bottle
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:
tp @a[score_ExpThrown_min=1] x y z
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:
scoreboard players set @a[score_ExpThrown_min=1] ExpThrown 0
That will reset the objective, so that you only get teleported once.
You are trying to insert a command into NBT data. You need to follow the correct format for NBT; the wiki lists data for the item format here.
In particular, you need to specify an id
string, Damage
short, Count
byte, Slot
byte, and tag
compound. The /give
syntax reflects all except Slot
:
/give <player> <id> [Count] [Damage] {tag}
Therefore, with the following /give
command:
/give @p minecraft:stone_sword 1 0 {Unbreakable:1b}
The data becomes:
{
id:"minecraft:stone_sword",
Damage:0s,
Count:1b,
tag:{
Unbreakable:1b
}
}
Your command will follow the same format, including the Slot
tag as the Items
list uses that tag to determine which slot in the inventory the item is in. Fixed command:
/setblock ~ ~1 ~ minecraft:chest 0 replace {Items:[{id:"minecraft:golden_axe",Count:1b,Slot:0b,Damage:0s,tag:{display:{Name:"Thor'sAxe",Lore:["Thegodliest","ofthegodliest."]},AttributeModifiers:[{AttributeName:"generic.maxHealth",Name:"generic.maxHealth",Amount:40,Operation:0,UUIDMost:69160,UUIDLeast:521589},{AttributeName:"generic.followRange",Name:"generic.followRange",Amount:32,Operation:0,UUIDMost:99396,UUIDLeast:851924},{AttributeName:"generic.knockbackResistance",Name:"generic.knockbackResistance",Amount:500,Operation:0,UUIDMost:76900,UUIDLeast:463228},{AttributeName:"generic.movementSpeed",Name:"generic.movementSpeed",Amount:0.5,Operation:0,UUIDMost:34152,UUIDLeast:644098},{AttributeName:"generic.attackDamage",Name:"generic.attackDamage",Amount:5,Operation:0,UUIDMost:85956,UUIDLeast:818955}],Unbreakable:1}}]}
Best Answer
Blocks don't keep names once placed. So finding a placed block with a name is not possible. Only items keep the name, once you shift their state all properties are restored to default.
Names are not stored in blockdata!!
But, a chest has a block entity associated with it that holds additional data about the block. The block's block entity ID is chest. As stated on the Minecraft Wiki:
The name of a chest is stored in the
CustomName
tag. So, to test for it, run this on a superfast clock: