0

I run a private server for my friends, and want to make a specific area mob-safe, without placing any block or light it. Changing the global difficulty or mob-spawning server property with command block is not an option: even if somebody is insed the area (enterieur of a huge building, actually), I need the mob spawning on the rest of the map work normally. Changing the biom to mushroom island is also not very good, because it is in the middle of a huge desert, and I want weather to work the same as its surroundings (ie. the rest of the desert).

Is there any way to do this, via command block, map edition, or maybe modding, scripting, etc.?

  • I don't know how to achieve this on an existing map, but if you can change the biome of the desired area to Mooshroom Island, no mobs will spawn. But this may also change grass colors and have other side effects. – Dan Bron Apr 20 '17 at 19:50
  • Mods or plugins can manage it for sure. Just look for admin utility mods on Curse or so. – Antoine Hejlík Sep 20 '17 at 7:01
2

This doesn't disable spawning, exactly, but it will kill all mobs within a certain radius. First, you have to create a team for your friends and you to stop yourselves getting killed when you enter that location. So, run a repeating command block with this command:

/kill @e[type=!Player,r=RADIUS]

Replace RADIUS with the amount of blocks you want the command block to check for in each direction. For example, if you had a 5x5x5 room, and the command block was in the center of the room, your radius would be two.

So, now, whenever mobs that are not players spawn in that area, it'll kill them.

However, mobs count as both hostile ones (like creepers) and docile ones (like chickens). If you, for example, want sheep to survive in that area, change the command to this:

/kill @e[type=!Player,type=!Sheep,r=RADIUS]

So now, the command block will allow sheep to spawn in that area. If you wanted to add a pig, do the same for the entity type Pig:

/kill @e[type=!Player,type=!Sheep,type=!Pig,r=RADIUS]

And so on.

If the command block output in the chat is getting annoying, type this into the chat, not the command block:

/gamerule commandBlockOutput false

Hope this helps!

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.