Here is another handy trick to summon an item entity with custom name, coloured name using section sign
§, and even with enchantments!
Manually prepare your item. If you need to enchant, do it with enchanted books and an anvil. If you need to rename, do it with an anvil. Use the section sign
§ in your item name to colour it.
Place a chest on the ground. Insert your item into the chest. Note the coordinates of this chest.
You will need to create a command chain to make this work. See this post for details on how to place command blocks correctly to chain them together. The command chain you are about to make will consist of 3 command blocks. (2 chain command blocks linked to an impulse command block)
In the 1st (impulse) command block, insert this command:
clone <templateX> <templateY> <templateZ> <templateX> <templateY> <templateZ> <destinationX> <destinationY> <destinationZ>
Clones the template chest to the location of your choosing.
You will need to replace the placeholders in the command with the actual coordinates of your template chest and destination location (without the angle brackets
5. In the 2nd block of the chain, insert this command:
setblock <destinationX> <destinationY> <destinationZ> air 0 destroy
Again, you will need to replace the coordinates without the angle brackets.
6. In the 3rd block of the chain, insert this command:
<yourZ> with the X, Y, and Z of your location.
And you're done! Try it out by placing a button on the 1st command block and giving it a press. You should see that the item you put in the chest will appear at the location you specified.
How It Works
- When a player breaks a chest, it drops all its contents.
destroy mode will act like the player broke the block, except the block does not drop itself. However, it will drop all its contents.
- The chest is cloned and deleted so quickly that we do not see the chest appear, or if we do, we only see it for about a millisecond. Otherwise, we just see an item drop appear out of nowhere!
- The last command deletes the chest. Because
destroy mode acts as if it is broken in Survival, it means the chest will drop too along with its items. This last command quickly deletes the chest before the player has a chance to pick it up.
- If one of the items placed inside the template chest is another chest, it will be deleted along with the template chest dropping itself. To combat this, use another storage device like a trapped chest.
Here are some ideas that could come next. Try them out!
- Now try putting more than one item in the chest. What happens?