Renaming items with the /give command in Minecraft PE [duplicate]
I'll take a shot at this...
Command structure: /give <player:target><itemName: Item>[amount: int] [data: int] [components: json]
There is not a one block solution. The reason is "Item" is the only thing you can /give
so if it's not a default minecraft:item (e.g minecraft:stone, etc...) you cannot /give
it.
There is a gadget you will need to make. I'll do my best to describe it. I use this in my command block typewriter to give a named map with instructions written on it to the player.
Start with 2 command blocks. They will be [R]epeat/[U]nconditional/[A]lways Active blocks. Each one will output a signal through a comparitor into the same solid block with a redstone torch on top. My code below is for a named map. Replace my map example with the item of your choice.
- Command block R/U/A:
/testfor @e[type=item,name="Control Panel Help"]
(This checks to see if the map I've named "Control Panel Help" is on the ground - a signal output happens if it is)
- Command Block R/U/A:
/clear @p map 6 0
(Clearing a map or item in a players inventory without taking it or taking 0 of it will produce a comparator signal letting us know the player has the item)
If either these commands returns true, the torch on the block they feed into will never light.
The redstone torch powers a row/series of commands with the first, an [I]mpulse]/[U]nconditional/[N]eeds Redstone above the redstone torch. Series is as follows:
Series 1 Command Block I/U/N:
/clear @p map 6 -1
(Clear all items in the players inventory matching map type 6)
Series 2 Command Block [C]hain/U/A:
/setblock <x y z> air 0 destroy
(x y z are the location where you will clone a container that holds the named item you want to get to your player. You will be using the destroy flag so the container drops the cloned named item)
Series 3 Command Block C/U/A:
/clone <start x y z> <end x y z> <destination x y z> replace normal
(Start and end are the same coordinate. At that coordinate a container, like a barrel or chest, where your master named item is stored. Destination x y z should be the location the setblock command in the prior step would destroy. In this example I'm using a Barrel)
Series 4 Command Block C/U/A:
/kill @e[type=item,name="Barrel",c=1,x=<destination x> y=<destination y> z=<destination z>,r=5]
(Basically we get rid of the Barrel container item on the ground but only the container that appeared as a drop when we destroyed it. Leaving just the named item on the ground.)
Whew!! Seems like a lot! Finally we have an item on the ground but only if it is not in a players inventory, which will be true at the start of a game. Nobody will have the named item.
We can now /tp the named item on the ground to any x y z coordinate entity or player.
Example tp the named item above the this calling command block
Command Block R/U/A :
/tp @e[type=item,name="Control Panel Help",c=1] ~ ~1.5 ~ false
The nice thing about my gadget is the player can drop the item and it will return to their inventory. If the player stashes it in a chest, it will be recreated in Inventory. It's the ultimate /give