Fill and Replace command with prefilled dispenser?

I'm creating a TNT cannon with dispensers and a clock. It's a long tower of dispensers and after the cannon is done firing TNT, you have to painfully refill it or at least replace it with this /give
given dispenser;
/give @p dispenser 1 0 {BlockEntityTag:{Items:[{id:"tnt",Count:64b,Slot:0b}, {id:"tnt",Count:64b,Slot:1b}, {id:"tnt",Count:64b,Slot:2b},{id:"tnt",Count:64b,Slot:3b}, {id:"tnt",Count:64b,Slot:4b}, {id:"tnt",Count:64b,Slot:5b}, {id:"tnt",Count:64b,Slot:6b}, {id:"tnt",Count:64b,Slot:7b}, {id:"tnt",Count:64b,Slot:8b}]}}
I know how to use the /fill command but is it possible to fill blocks with a prefilled dispenser?
Like this; /fill ~ ~ ~ ~5 ~ ~5 dispenser 0 {FILLED ITEMS} replace wool 14
The above should replace all red wool within the relative dimensions of 6x6x1 with prefilled dispensers.
Best Answer
Your fill statement is almost correct. You have to specify oldBlockHandling, as per the syntax of the command:
fill <x1> <y1> <z1> <x2> <y2> <z2> <TileName> [dataValue] [oldBlockHandling] [dataTag]
(http://minecraft.gamepedia.com/Commands#fill)
Your command would look like this:
/fill ~ ~ ~ ~5 ~ ~5 minecraft:dispenser 0 replace {Items:[{id:"tnt",Count:64b,Slot:0b}, {id:"tnt",Count:64b,Slot:1b}, {id:"tnt",Count:64b,Slot:2b},{id:"tnt",Count:64b,Slot:3b}, {id:"tnt",Count:64b,Slot:4b}, {id:"tnt",Count:64b,Slot:5b}, {id:"tnt",Count:64b,Slot:6b}, {id:"tnt",Count:64b,Slot:7b}, {id:"tnt",Count:64b,Slot:8b}]}
Note that if you want to change the rotation of the dispenser, you would change the dataValue.
Pictures about "Fill and Replace command with prefilled dispenser?"



Is there a command in Minecraft to fill dispensers?
[ ] = Dispenser filled with TNT [Arrows = face direction] [\xee] = Dispenser filled with TNT facing north and Redstone Torch on top.How do you get pre filled dispensers in Minecraft?
Bedrock edition command for replacing water blocks Once they have both the coordinates, Bedrock edition players need to type "/fill <first coordinates> <second coordinates> air 0 replace water" in the chat window. This will only replace the water blocks present in the coordinates.[FASTEST WAY] How to Fill Anything in Minecraft Quickly Tutorial
More answers regarding fill and Replace command with prefilled dispenser?
Answer 2
This is what your command is supposed to be:
/give @p dispenser 1 0 {BlockEntityTag:{Items:[{id:"tnt",Count:64b,Slot:0b},{id:"tnt",Count:64b,Slot:1b},{id:"tnt",Count:64b,Slot:2b},{id:"tnt",Count:64b,Slot:3b},{id:"tnt",Count:64b,Slot:4b},{id:"tnt",Count:64b,Slot:5b},{id:"tnt",Count:64b,Slot:6b}, {id:"tnt",Count:64b,Slot:7b},{id:"tnt",Count:64b,Slot:8b}]}}
Answer 3
/fill ~ ~ ~ ~15 ~ ~11 minecraft:dispenser 0 replace {Items:[{id:"tnt",Count:64b,Slot:0b}]} i made this, its a 15 x 11 format for a chaos cannon, only 1 stack of tnt but it will always fit in the chat box
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Ketut Subiyanto, Emre Can Acer, Emre Can Acer, Sora Shimazaki