Minecraft – How to stop bats from spawning

minecraft-java-edition

Is there an edit to the game files that I can do to stop bats from spawning in minecraft? I would guess that I can change something in the minecraft.jar file but I am not really sure how and what to do.

Best Answer

You can (depending on your version) use a command block and trigger it on a one second redstone clock. You just program the block to:

/kill @e[type=nameofmobtokill]

So in your case:

/kill @e[type=bat]

There's no need for that to execute on every tick, but it's up to you to figure out how to make sure the command block remains chunk loaded (placing it at the world's spawn point should probably do it).

Credit to stef for mentioning this in an answer to a nearly identical question about accomplishing the same with endermen.

However, you can't craft command blocks, so you have to be in creative mode both to obtain and remove one, as well as make changes to their programming. They can be placed in survival, but any productive use has to be arranged through creative mode.

Without using a command block, or a mod designed to control how / when / where mobs spawn, there's no practical or effective way to accomplish it. Bats are tricky in particular because they can spawn in any single vacant block where the light level is sufficiently low. Zombies and Skeletons need at least a two-block high area in order to spawn.

You could write your own mod to prevent them from spawning, I don't think it would be entirely difficult. I'd recommend going with what's available in Forge since it's very well-maintained and supported, plus its wide-use lets lots of others enjoy your mod if you wish to share it. It'd probably be a great exercise in larning how things work, sort of like a 'hello world' mod.