Container Give Command Generator — Pre-Filled Chest & Shulker Box (Java Edition)
Uses modern Minecraft item component syntax (1.20.5+). On older versions these need the legacy NBT tag format instead.
How to Use the Container Generator
- Pick a target selector (defaults to
@p, the nearest player). - Choose the container type: chest, barrel, or shulker box.
- Set a slot number, item ID, and count for one or two item entries.
- Copy the generated
/givecommand.
Syntax Reference
A pre-filled container carries a container item component – a list of {slot, item} entries describing exactly what sits in which slot before the block is ever opened:
/give @p minecraft:chest[container=[{slot:0,item:{id:"minecraft:diamond",count:1}},{slot:1,item:{id:"minecraft:emerald",count:1}}]]
Slot numbers are 0-indexed, top-left to bottom-right, so slot 0 is the top-left slot and slot 26 is the bottom-right slot of a single chest (27 slots total) or a shulker box (also 27 slots). A double chest has 54 slots, though placing two separate single-chest items next to each other does not automatically merge their contents into one double-chest inventory – that only affects visual double-chest rendering when adjacent, contents stay per-block. Any slot left out of the list is simply empty.
Frequently Asked Questions
What’s the actual difference between using a chest, barrel, or shulker box here?
The container component works identically across all three block types – same slot numbering, same item entry format. The practical difference is just what happens in-game afterward: a shulker box keeps its contents intact if broken and picked back up (great for pre-loaded loot you can carry around), while a chest or barrel dropped without Silk Touch loses its contents to the ground.
Can I pre-fill items with their own components, like an enchanted sword?
Yes – the item field inside each container entry accepts a components sub-field the same way a top-level /give item does, so you can nest enchantments, custom names, or other components on items placed inside the container. This generator’s simplified UI only sets plain item ID and count; add a nested components object manually for anything more complex.
Does this work for placing the container directly with /setblock instead?
Not directly – /setblock uses block-state and block-entity NBT rather than the give-side item component, though the underlying data (a list of slot/item entries) is conceptually the same. This generator is specifically for handing a player a pre-filled container item via /give.
What happens if two entries claim the same slot number?
Only one item ends up in that slot – behavior in that conflict case isn’t something you should rely on, so keep each slot number in the list unique. This generator’s two-entry UI defaults to slot 0 and slot 1 to avoid the collision entirely.
Related Tools
- Bundle Give Command – give a bundle pre-filled with a flat list of items instead of slotted container contents.
- Give Command Generator – the full item builder, including all 16 special-item tabs.
- Mob Summon Generator – spawn a mob that carries specific equipment.