Minecraft spawning items with inventories in them

Minecraft spawning items with inventories in them - Assorted-color Bricks

I was wondering, is there a way to spawn a dispenser that is filled with snowballs using a command? Like, i want to be able to /fill over a row of dispensers with full dispensers... so how would I specify the inventory of the spawned block in the command?



Best Answer

Please see

Minecraft Empty Chests Command Block

as I think this answers you question.

Let's say for example your equipment chest is supposed to contain a notch apple, a gold sword, a bow, and a stack of arrows. The command for that would be /blockdata X Y Z {Items:[{id:322,Damage:1,Count:1,Slot:0},{id:283,Count:1,Slot:1},{id:261,Count:1,Slot:2},{id:262,Count:64,Slot:3}]}, replacing X Y and Z as appropriate. There's a lot of stuff going on in that command, but essentially, you are changing the data of the chest to contain the specified items. It's the same concept as using /setblock to spawn a new chest with these items, except instead of replacing the chest, you're overwriting its data.




Pictures about "Minecraft spawning items with inventories in them"

Minecraft spawning items with inventories in them - Woman in Pink Coat Holding Shopping Bags
Minecraft spawning items with inventories in them - Different Items over a White Table
Minecraft spawning items with inventories in them - White and Purple Ice Cream



How do you spawn items in your inventory in Minecraft?

Open the chat window in your game. Type \u201c/gamerule keepInventory true\u201d in the chatbox. Press \u201cEnter.\u201d After you die, you'll still have all your tools.



Summon items into Minecraft with 1 simple command item generators.




More answers regarding minecraft spawning items with inventories in them

Answer 2

If you're making something not automatic,fill a dispenser with snowballs(anything with any inventory type will work),and ctrl+select it, eg. ctrl+scrollwheel button. You're gonna get an item with an NBT tag on it. Then when you place the item/block down,it will be filled with exact stuff it was filled when you selected it.

Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Alexander Grey, Andrea Piacquadio, PNW Production, EKATERINA BOLOVTSOVA