If you are about to die by mobs in a cave with 0.5 hp you can pause the game and change the difficulty to peaceful, in my opinion this should not be allowed, or it should be to considered cheating.