Arqade Asked on November 30, 2020
Are you looking for how to get a block with preset data into your inventory? See this post.
I am making an adventure map for my friends.
I have made a system where, when a button is pressed, a chest appears next to the player with some items. The problem is, /setblock
only can set an empty chest next to the player, not one with items inside. In Java Edition, these commands would have worked:
/setblock ~ ~ ~ chest{Items:[{Slot:0b,id:"minecraft:dirt"}]}
How can I set a chest with items next to the player?
This can also apply to signs with text, command blocks with settings, and other container blocks with items such as dispensers, droppers, hoppers, etc.
It's actually quite simple to do. The solution I present works in Bedrock and Java edition, and could actually be simpler if you're setting a block with lots of items!
Place the block you want to set in a template location.
Use /clone
to copy it to the target location. Example command:
/clone Tx Ty Tz Tx Ty Tz Rx Ry Rz
T
: Template location.
R
: Target location.
You need to specify the template location twice, to say that only that one block should be cloned.
This works for any block you want to copy.
Browse more workarounds for getting/setting NBT in Bedrock Edition
Correct answer by ExpertCoder14 on November 30, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP