mojira.dev
MC-203646

Some mobs won't despawn when switched to peaceful

The Bug

Switching to peaceful sometimes leaves hostile mobs behind. They have their hitboxes, but cannot be pushed, and instead pushing you. They do not move nor react to the player (even in survival). Switching to hard difficulty and back to peaceful does nothing to them. Exiting the world and entering back gets rid of them.

To Reproduce

  1. Spawn in a new world with cheats, in peaceful, in survival

  2. Execute these commands for faster testing

    1. /give @p minecraft:spyglass

    2. /give @p minecraft:creeper_spawn_egg 64

    3. /give @p minecraft:ender_pearl 64

    4. /gamerule keepInventory true

    5. /gamerule mobGriefing false

  3. Walk approximately 150 blocks away from spawn (enderpearls to go faster)

  4. Execute /time set midnight

  5. Execute /difficulty hard

  6. Spawn creeper, walk into its explosion, and die (I cannot seem to consistently reproduce this by using /kill)

  7. Quickly execute /difficulty peaceful (the faster you execute it, the more mobs tend to stick around I've found)

  8. Walk the direction of your death (I used the spyglass and hitboxes to better look around)

  9. ❌ Hostile mobs are still around despite the difficulty being peaceful

My guess is something to do with the quick movement of the player and despawn/spawn spheres.

Linked issues

Attachments

Comments 2

Similar problem. Opened a creative snapshot world. Switched from creative to survival a few times to test the shulkers spawning feature—shulkers could be killed/de spawned normally. Increased the random tick speed to 1000 to watch amethyst crystals grow. Then doused myself with a splash potion of night vision and switched to spectator to look for amethyst geodes. When I found a geode cave there were 4 creepers and 3 skeletons just standing there. Still had the ‘breathing’ animation but couldn’t be punched and didn’t react to me when I switched to survival.

Noki

boq

Community Consensus

Important

Entities

20w45a

20w46a

Retrieved