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!

  1. Place the block you want to set in a template location.

  2. 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.