Minecraft – How to summon this sequence of stacked mobs

minecraft-commandsminecraft-java-edition

I am making a costum map and I want to summon this kind of "mob tower"

 M
---
 V
---
 B

Where M= Invisible Mooshroom, V=Villager and B=bat. --- are layers of obsidian blocks that already exists in the world.

The Villager is used for some mob tracking magic using Zombies. The bat is for randomizing the movement of the stack and the invisible Mooshroom is used for targeting other commands. There should also be a way to kill a single stack (i.e. kill Mooshroom, Villager and Bat, without killing all of them.

The logic of the game I try to make is this:

  1. Four stacks will be summoned on the field.
  2. After a random time the mooshroom closest to the center of the field will explode, I teleport primed TNT to it.
  3. The villager and the bat of that stack will be killed as well as every zombie in the game.
  4. The next closest stack will do the same until all 4 stacks are gone.

I have tried summoning different stacks and watching some tutorials but I have major trouble getting the spacing right, I just can't get any space between them. Also I forgot how an effect is added. I did found that invisibility is effect 23 or something (I can figure that out myself, don't even worry about it) but I don't know the syntax.

Can someone just tell me the commands for spawning and killing the stack?

Best Answer

/summon MushroomCow ~ ~ ~ {ActiveEffects:[{id:14,Duration:100000,Amplifier:1,HideParticles:1}],Riding:{id:"Spider",Attributes:[{Name:"generic.maxHealth",Base:10000}],Riding:{id:"Villager",Attributes:[{Name:"generic.maxHealth",Base:10000}],Riding:{id:"Spider",Attributes:[{Name:"generic.maxHealth",Base:10000}],Riding:{id:"Bat",Attributes:[{Name:"generic.maxHealth",Base:10000}]}}}}}

Explanation:

I used a spider to separate the mobs in the end as it's exactly 1 block tall. It is invulnerable to suffocation (because it has like 10000 health).

Also, all mobs have 10000 health, so even when they are stuck in a block because of the bat, they don't die. Change health by changing the number of baseHealth in this section: Attributes:[{Name:"generic.maxHealth",Base:<HP>}]

To kill the whole stack, first off, you have to make sure all commands blocks are activated at the very same time -- exact same time, or it may result in idling totems of mob towers. Then type in the command /kill @e[type=Bat,c=1,r=<size of the field>] in command block A, /kill @e[type=Villager,c=1,r=<size of the field>] in B, /kill @e[type=Mooshroom,c=1,r=<size of the field>] in C and /kill @e[type=Spider,c=2,r=<size of the field>] in D. Then you should be able to kill the whole stack.

I don't have a computer now so I cannot check the code, but feel free to tell me if it worked or not. Thanks!