I have a schematic of a large build with a couple hundred empty dispensers (facing all different directions) that I wanted replaced with TNT-filled dispensers. I was messing around with the /fill command and replace [oldBlockHandling] but couldn't get it to work.

/fill -884 28 977 -889 25 972 minecraft:dispenser 0 replace {Items:[{id:"tnt",Count:64b,Slot:0b}]}

I cut the filling slot to 1 because it won't fit in chat but all this command does is completely fills my selected area with filled dispensers. It doesn't selectively replace empty dispensers, which is what I want. Anyone know what I'm doing wrong? Thanks.

  • 1
    "all this command does is completely fills my selected area with filled dispensers" Isn't that exactly what you want? If not, what do you want? And what doesn't work about that command? – Fabian Röling Mar 30 at 16:16
  • 1
    well i wanna replace empty dispenser with full dispensers. so far all im getting is a complete a huge block of dispenser, like the replace part isn't working only the fill is. – 416285 Mar 30 at 22:43
  • Oh, now I see the problem. – Fabian Röling Mar 31 at 12:11

The NBT of the to be placed block belongs directly after the to be placed block (technically it's even a part of it). And you didn't tell the game which block to replace. And metadata (the 0) no longer exists.

/fill -884 28 977 -889 25 972 dispenser{Items:[{id:"tnt",Count:64b,Slot:0b}]} replace dispenser
| improve this answer | |
  • I wrote my 666th answer while it was the first of April in New Zealand and a few other regions. 🤔 – Fabian Röling Apr 2 at 22:34

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.