I can't figure out how to get an item that is renamed using the /give
command and I have tried the command I found here, /give @s stone 1 0 {display:{name:"name"}}
but it keeps saying that I am missing a close bracket in line 1, column 2. I have as many closed brackets as I do open brackets. I want to know this because I am making a private server in Minecraft PE.
-
4Duplicate of How do you add NBT tags to commands in Minecraft Pocket/Bedrock Edition?– Fabian RölingApr 30, 2020 at 8:58
1 Answer
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
-
What the… I don't know what this super long answer is all about, but it definitely does not fit to the question. The person just asked how to give a named item to someone in MCBE, to which the answer is simply "you can't, MCBE doesn't have NBT in commands". Apr 30, 2020 at 8:58
-
This seems like a nice workaround to get the same effect (give a named item), if a bit poorly explained (perhaps include a diagram for the apparatus?) . Though the additional 'persistence' / 'looping' it causes may not be wanted. The asker might want the item to not self-duplicate, so is it possible to modify this minecraft 'program' so this does not happen; i.e. just hand out one copy of named item X to player P?– aphidApr 30, 2020 at 10:26