2

I'm making a maze where you have to fight zombies and get to the end, but all these other mobs start showing up and I can't figure out how to spawn only zombies. Also, I can't use dispensers.

5
  • 2
    What are you using to spawn them at the moment? Mob spawners, summon command, spawn eggs? Do you just want to turn off natural spawning of other mobs?
    – SirBenet
    Commented Apr 18, 2015 at 22:08
  • I'm not using anything (yet) because I cant figure out how without using dispensers. Mob spawners also wont work because they'd have to be underground. If there's a way to do it with command blocks, that would be great
    – xXPikminXx
    Commented Apr 18, 2015 at 23:26
  • @xXPikminXx I fail to see how mob spawners underground is unworkable. You have a maze. Just put them underneath or inside the walls of the maze. Mapmakers do that all the time.
    – Unionhawk
    Commented Apr 20, 2015 at 19:02
  • @Unionhawk if I put a mob spawner underground, it wouldnt spawn them because they would just suffocate in the ground .-.
    – xXPikminXx
    Commented Apr 20, 2015 at 21:30
  • 1
    @xXPikminXx It absolutely would spawn them. First of all, mob spawners check for valid spawning spaces before doing anything; they never spawn mobs inside blocks because that is not a valid spawning space. Secondly, spawners spawn mobs in a space that is 8 blocks wide, 8 blocks wide, and 3 blocks wide by default, centered on the spawner. So spawners placed flush with the floor will spawn mobs on the level of the floor, and spawners placed inside a wall will spawn mobs outside that wall.
    – Unionhawk
    Commented Apr 20, 2015 at 21:35

5 Answers 5

2

Here are the brief steps to ensure only zombies and players live.

(Thanks Unionhawk for pointing out my mistake in the first answer and providing suggestions on this answer!)

  1. Make a redstone clock.

  2. Connect 4 command blocks into the redstone clock.

  3. Insert these commands into the command blocks:

    kill @e[type=Skeleton]
    
    kill @e[type=Creeper]
    
    kill @e[type=Enderman]
    
    kill @e[type=Spider]
    

    3.5 If you are in a superflat world you may want to add a kill Slime command.

  4. Remember to activate these command blocks at the same time.

  5. Activate the redstone clock.

  6. Done.

You can also make the super fast command block clock but you have to change the doTileDrops gamerule to false.


Here are the brief steps to spawn a zombie.

  1. Place a command block on the ground.

  2. set the following command:

    summon Zombie ~ ~2 ~
    
  3. Activate it.

This will make the zombie spawn 2 blocks on top of the command block.

5
  • 1
    You may want to rethink your commands; /kill @e[type=!Zombie] will kill the player.
    – Unionhawk
    Commented Apr 20, 2015 at 18:50
  • Hmm. Forgot that. Thanks for reminding. Maybe I should use the scoreboard to do this?
    – 54D
    Commented Apr 20, 2015 at 22:57
  • You could, but the easier way would be to use 3 separate commands; /kill @e[type=Creeper] etc.
    – Unionhawk
    Commented Apr 20, 2015 at 23:24
  • So I should make a command block for every mob...?
    – 54D
    Commented Apr 20, 2015 at 23:30
  • You only really need 4 to cover natural hostile mob spawns. Creepers, skeletons, and endermen, and spiders.
    – Unionhawk
    Commented Apr 20, 2015 at 23:32
1

To spawn a zombie with a command block, type in the command:

/summon Zombie X Y Z

Replace X Y Z with the coordinates of where you want to spawn the zombie.

4
  • when I do that it just says "Unable to summon object". Do I need to do "x=(x) y=(y) and z=(z)"?
    – xXPikminXx
    Commented Apr 19, 2015 at 0:31
  • @xXPikminXx Yes, replace X Y Z with the coordinates of where you want to spawn the zombie.
    – SirBenet
    Commented Apr 19, 2015 at 9:55
  • Actually the syntax is normally ~x ~y ~z for coordinates. If you left it blank (~ ~ ~) it would summon them right on top of the location of origin (i.e. if you executed the command, it would appear in your block, or on top of a command block if that was the point of origin)
    – Ben
    Commented Apr 20, 2015 at 5:06
  • @Ben ~ makes the coordinates relative, rather than normal coordinates. Just replacing X Y Z with the coordinates will work.
    – SirBenet
    Commented Apr 20, 2015 at 16:11
1

Setup:

/scoreboard objectives add selector dummy

Clock(20tps)

/scoreboard players set @e selector 1
/scoreboard players set @e[type=<Type>] selector 0//One of these per entity type, in this case one for zombie and one for players
/tp @e[x=<X>,y=<Y>,z=<Z>,r=<Range>,score_selector_min=1] ~ ~-600 ~

First it marks all entites, then unmarks the selected entite(s), and finally teleports the marked entites down into the void so there is no dying animation and no items drop.

1

Use a command block to set certain gamerules. If you program one with this command,

/gamerule doMobSpawning false

then mobs can only spawn if you spawn them in with /summon, a spawn egg, a dispenser, etc.

0

Method #1:

You can do this by auto-killing all hostile mobs that are not Zombies - Plug in Command blocks with these commands into a fast Redstone clock (or use the 1.9 Command Block fetures):

/kill @e[type=Spider]

/kill @e[type=Enderman]

/kill @e[type=Creeper]

/kill @e[type=Skeleton]

/kill @e[type=CaveSpider]

/kill @e[type=Witch]

/kill @e[type=Slime]

/kill @e[type=Guardian]

Method #2 (the hardcore one):

When a non-Zombie hostile mob spawns, replace it with a Zombie - Again, on a fast RS clock plug Command blocks with these commands:

/execute @e[type=Spider] ~ ~ ~ summon Zombie ~ ~ ~

/execute @e[type=Enderman] ~ ~ ~ summon Zombie ~ ~ ~

/execute @e[type=Creeper] ~ ~ ~ summon Zombie ~ ~ ~

/execute @e[type=Skeleton] ~ ~ ~ summon Zombie ~ ~ ~

/execute @e[type=CaveSpider] ~ ~ ~ summon Zombie ~ ~ ~

/execute @e[type=Witch] ~ ~ ~ summon Zombie ~ ~ ~

/execute @e[type=Slime] ~ ~ ~ summon Zombie ~ ~ ~

/execute @e[type=Guardian] ~ ~ ~ summon Zombie ~ ~ ~

And, if any of these Command blocks has a positive output, trigger a Command block with this command (using a Comparator):

/execute @e[type=Zombie] ~ ~ ~ kill @e[type=!Zombie, r=2]

Note: the r=2 is important, because if the mob would move when spawned and the command would be r=1, it wouldn't get killed, just moved - many mobs would spawn.

Note: You can redo this to the 1.9 Command block structure.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .