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.
- Spawn in a new world with cheats, in peaceful, in survival
- Execute these commands for faster testing
- /give @p minecraft:spyglass
- /give @p minecraft:creeper_spawn_egg 64
- /give @p minecraft:ender_pearl 64
- /gamerule keepInventory true
- /gamerule mobGriefing false
- Walk approximately 150 blocks away from spawn (enderpearls to go faster)
- Execute /time set midnight
- Execute /difficulty hard
- Spawn creeper, walk into its explosion, and die (I cannot seem to consistently reproduce this by using /kill)
- Quickly execute /difficulty peaceful (the faster you execute it, the more mobs tend to stick around I've found)
- Walk the direction of your death (I used the spyglass and hitboxes to better look around)
- 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.