I'm used to creating Java Edition Minecraft maps, where NBT can be used to set many different block, item, and entity properties, like an item's CanPlaceOn
/CanDestroy
list, a chest's items, and more!
To open my maps up to more players, I've started creating maps on Minecraft Bedrock Edition as well. But NBT is inaccessible from commands in BE, which I knew before, but didn't know how much of a problem I would have creating these complicated command chains.
One of the things that I've always been doing is giving players items with custom item names, lores, enchantments, and other properties.
But there is a problem. All this would have been done in NBT in Java Edition. In Bedrock, NBT is inaccessible from commands, meaning the commands I used in JE don't work. Are my dreams crushed?
Browse more workarounds for getting/setting NBT in Bedrock Edition
Best Answer
Instead of storing the item in a chest, you store it in a structure by saving a 1×1 structure that consists of just air and the item entities. So the step by step guide is:
Now that you know the plan, let's begin!
Step 1: Customize your item
So to do this, you're going to need to prepare your item in your inventory. Please observe the following things that you can do to prepare your item:
Properties that can be set/changed without using this method
You can set the following item properties in a direct command without having to use this method:
/give
with the JSON components.Properties you can set/change with this method
The following properties can be changed within the game using this method:
/enchant
while holding the item in your main hand. You may not exceed the maximum enchantment level, and you may not enchant items that don't make sense with that enchantment (so no enchanting a fish with Knockback X), but you can use an NBT editor—see below.Properties that require an NBT editor to be set/changed
The following properties can be changed through one-time use of an NBT editor. Follow these instructions to modify any of the below listed properties, and place the item in the chest. The below commands will then work to give an exact copy of the item, even with some properties changed, without requiring use of an NBT editor ever again.
Properties you cannot set/change
These are item tags that exist in Java Edition, but the matching NBT tag in Bedrock Edition has not been discovered, or is nonexistent. Feel free to tinker with the NBT tags in an editor, and if you can find any new NBT tags, please comment so I can add to this post!
Step 2: Create the setup
Next we need to create the setup of structures. This is how:
Ensure you have positional coordinates shown. If not, run this command in your chat:
Pick a block on the ground. Any block will do, as long as it is a full block (not bottom slab, not chest, not soul sand, etc.). Stand on it, and note the coordinates that are currently in your position.
You need a structure void for this. Type the following command in your chat:
Place the structure void on the block of ground you picked in step 1.
Throw the item that you have customized onto the ground there too. Ensure it is in the same block as the structure void, not next to it.
From this point, you have 5 minutes to complete the next step. Take too long and your items will disappear!
Run the following command to save the structure:
But replace the following items in the above command:
<name: string>
with a memorable name for your structure. Do not forget it or else you will have to create another one without deleting the old one, taking up memory slowly. How wasteful!<from: x y z>
with the X, Y, and Z coordinates that I told you to write down in step 1.<to: x y z>
with the X, Y, and Z coordinates that I told you to write down in step 1. This means that you should have specified the same coordinates twice.Step 3: Setup the commands
Setting up the commands is the last thing we need to do before our setup is complete! Place down a single impulse command block that will activate to give our player the item.
That's right, only one command is needed for this:
Replace
<name: string>
with the name you saved your structure as. Don't remember it? Now you have to go back to step 2 and create a new structure without deleting the old one because you don't remember its name. How wasteful!Once you've set up this command block, run it, and you should see that the item entities are summoned right on top of you so you don't need to run and fetch them. Hooray!