0

Lots of people have asked questions about how to stop mobs from spawning, but the answers are almost always to /kill them all. This is not what I want. I don't know if this is possible, but using scoreboards, gamerule, whatever, I want to stop bats from spawning in the first place. This way, somebody can use mobs like bats without them dying. I know doMobSpawning false is a gamerule I could use, but that stops ALL mobs from spawning. It's likely relevant to note that this is on a minecraft realm, and while that gamerule is on, there's a setting that makes hostile mobs not spawn on their own while passive mobs do. Sadly, bats are considered passive despite how annoying they are. xD I know also that this likely isn't possible, I'm just seeing if anyone knows a way. Again, no /kill involved. (Unless is somehow doesn't kill pre-existing bats... using tags? hm. If there's an NBT tag for having spawned in a spawn egg, I can use that. Thanks!)

1

There isn't a tag for being spawned by a spawn egg, but you can give entities your own tags with custom spawn eggs:

/give @s bat_spawn_egg{EntityTag:{Tags:["dontkillmepls"]}}

Now you just need to kill all bats that don't have the "dontkillmepls" tag. Or, even better, teleport them to y=-65, where they are deleted instantly, without animation and sound.

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.