How to prevent all hostile mobs from spawning except for skeletons
I am trying to make a map where only skeletons and non-hostile mobs are able to spawn. Is there a command that can do this? I don't want a redstone clock because that will lag my game and spam the chat. I am using 1.10.2.
Best Answer
Try This
Enter this command in chat:
/scoreboard objectives add noKill dummy
Then run these commands on a repeating command block or clock:
/scoreboard players set @e noKill 1
/scoreboard players set @e[type=Player] noKill 0
/scoreboard players set @e[type=Skeleton] noKill 0
Keep adding entities that you don't want to be killed
Then this command will kill all entities that don't have a noKill score of 0:
/kill @e[score_noKill_min=1]
Hope that helps you. :)
Pictures about "How to prevent all hostile mobs from spawning except for skeletons"



What blocks can hostile mobs not spawn on?
Use a fence or a wall to keep all mobs except spiders and spider jockeys off your lawn. Though to keep spiders and spider jockeys out, just ring the top of your house with any block. You can create iron golems to defend your territory. These metal wonders will deal lots of damage to any mobs that come near it.How do you keep hostile mobs away in Minecraft?
Only skeletons can spawn on bone blocks.Peaceful Mode Switch- Prevents hostile mobs from spawning! | Minecraft
More answers regarding how to prevent all hostile mobs from spawning except for skeletons
Answer 2
In a repeating, always active command block type:
/kill @e[type=!Player,!Skeleton,!Item]
This will kill any entity that is not a player,skeleton or an item if you need to keep other entity's e.g. an ArmorStand add another comma and write the name of the entity you want to preserve so in this case you would add ,[type=!ArmorStand]
Hope this helps.
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Brett Sayles, Karolina Grabowska, Karolina Grabowska, Karolina Grabowska
