Arqade Asked on December 26, 2020
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
Your dreams aren't crushed quite yet. Although it may be true that NBT is inaccessible from commands, there is still a workaround for what you want to do!
Here's a handy workaround that lets you give items with custom names and enchantments.
My plan is:
/setblock
in destroy
mode to destroy the chest, causing it to drop all its items on the player.So to do this, you're going to need to place a chest in a template location, manually prepare your item, and place it into the chest. Here is a list of all available and unavailable properties to customize your item:
The following properties can be changed within the game:
/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./give
with the JSON components can_place_on
and can_destroy
, without going through all this extra work. But if you want to combine this with some of these other customization methods, follow the instructions in the linked post, then come back here.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.
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 suggest an edit so I can add to this post!
Now let's create the command chain we'll be using. Place an impulse command chain of 4 blocks.
Choose the command chain that best suits you.
Tell the player to clone the chest to their position.
execute @p[name=THE_PLAYER_TO_TARGET] ~ ~ ~ clone Tx Ty Tz Tx Ty Tz ~ ~ ~
Replace Tx
, Ty
, and Tz
with the template location in both coordinate specifications.
Tell the player to set the block to air and destroy the chest.
execute @p[name=THE_PLAYER_TO_TARGET] ~ ~ ~ setblock ~ ~ ~ air destroy
Kill the chest.
kill @e[type=item,name=chest]
Clone the chest.
clone Tx Ty Tz Tx Ty Tz Rx Ry Rz
T
: Template location.
R
: Target location.
Set the chest to air and destroy it.
setblock Rx Ry Rz air destroy
Kill the chest.
kill @e[type=item, name=chest]
While this trick is handy, sadly, I cannot claim ownership of it. I discovered it in a map in Minecraft: Education Edition, from the We Are the Rangers library. I saw it as part of a task in the map, and while looking in the commands, it was too good to not post here. Thank you to the Minecraft Education Edition team at Microsoft for creating such awesome maps!
Correct answer by ExpertCoder14 on December 26, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP