I was working on a large Minecraft survival map. To achieve the perfect setting, I wanted to make it impossible for hostile mobs to spawn but still allow players to become hungry and have non-hostile mobs spawn.

I was wondering if there was a way to make players hungry in peaceful mode or simply prevent hostile mobs from spawning using commands.

1 Answer 1

/gamerule doMobSpawning false
/gamerule doInsomnia false
/gamerule doPatrolSpawning false
/gamerule doWardenSpawning false
/gamerule doTraderSpawning false

If you want random wandering traders to still spawn don't run the one above

/difficulty normal

And that should be it.

  • 1
    This answer only partly answers the question as this solution prevents non-hostile mobs (sheep, cows, etc…) from spawning. Commented Mar 14, 2023 at 15:26
  • @HomegrownPotatoes If you are making a survival map I would assume you are already generating the chunks (otherwise it's not really a map) in which case mobs would already spawn at such a slow rate that you would probably have to use commands to spawn the mobs anyways. You could generate new chunks to see how often mobs spawn and do something with commands such as /spreadplayers Commented Mar 23, 2023 at 23:12
  • well if that’s true, that gives me some questions. I had absolutely no idea mobs still spawned in loaded chunks even when mob spawning is off, are you absolutely sure this is the case? And even if it is that still doesn’t prevent hostile mobs from spawning unless it does for some reason. Beside, feel free to ignore this comment as I already created a system of command blocks that instantly teleports all hostile mobs into the void. Commented Mar 24, 2023 at 3:05
  • 1
    @HomegrownPotatoes sorry i worded it badly, what I meant is that even if mob spawning is on passive mobs spawn really slowly in already-generated chunks. Glad to see that you have got it working though! Commented Mar 25, 2023 at 14:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .