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.

  • 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 Apr 18 '15 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 Apr 18 '15 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 Apr 20 '15 at 19:02
  • @Unionhawk if I put a mob spawner underground, it wouldnt spawn them because they would just suffocate in the ground .-. – xXPikminXx Apr 20 '15 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 Apr 20 '15 at 21:35
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.

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

This method makes only zombies spawn naturally, but they can also be spawned using spawner blocks or mob eggs.

  1. Make a redstone clock set to 8 ticks.
  2. Create the team: NoKill
  3. Make a second redstone clock on 4 ticks, then put in the command:/scoreboard teams join NoKill @a
  4. Enter the command into the first command block you placed:

    /kill @e[team=!NoKill,type=!Zombie]

Hope this helps!

|improve this answer|||||
  • You could do this a bit more cleanly by teleporting the undesired entities into the void, /tp @e[type=Whatever] ~ -1 ~. Multiple whitelisted command blocks may also be desirable. – Unionhawk Apr 20 '15 at 18:49
  • :O sweet I never thought of that! – xXPikminXx Apr 20 '15 at 21:30
  • 2
    I thought you cannot specify 2 types at the same time... :P – 54D Apr 20 '15 at 23:34
  • 1
    You cannot do this in minecraft, it does not support multiple type Syntax – ModDL Apr 21 '15 at 0:30
  • Not sure why this is the highest upvoted answer, it literally won't work. @e[type=!Player,type=!Zombie] will kill both all zombies and all players. – SirBenet Apr 21 '15 at 18:14
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.

|improve this answer|||||
  • when I do that it just says "Unable to summon object". Do I need to do "x=(x) y=(y) and z=(z)"? – xXPikminXx Apr 19 '15 at 0:31
  • @xXPikminXx Yes, replace X Y Z with the coordinates of where you want to spawn the zombie. – SirBenet Apr 19 '15 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 Apr 20 '15 at 5:06
  • @Ben ~ makes the coordinates relative, rather than normal coordinates. Just replacing X Y Z with the coordinates will work. – SirBenet Apr 20 '15 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.

|improve this answer|||||
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.

|improve this answer|||||
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.

|improve this answer|||||

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.