Difficulty



Difficulty is an option in Minecraft that has a direct impact on the ease of gameplay.

General difficulty
There are currently four difficulty settings in the game:



Peaceful: No hostile mobs can spawn naturally (with the exception of the ender dragon, which does not deal damage). When hostile mobs attempt to spawn (whether naturally, through mob spawners, spawn eggs, or commands), they are removed from the game instantaneously. Switching from any other difficulty setting to Peaceful removes existing hostile mobs, except for hostile wolves, iron golems, and shulkers. Players regain health over time. Despite regaining health over time, it is still possible to die if damage is received quickly enough. The hunger bar never depletes and players cannot eat anything except golden apples, unless the player has switched to Peaceful when their hunger bar was below the maximum. If it is below the maximum, it quickly regenerates.

Easy: Hostile mobs spawn, but they deal less damage than on Normal difficulty. The hunger bar can deplete and will leave the player with if it drains completely. Cave spiders cannot poison players on Easy difficulty, and the Wither won't cause the wither effect, although wither skeletons will. Lightning only sets the struck block on fire, not surrounding blocks.

Normal: Hostile mobs spawn, and will deal standard damage. The hunger bar can deplete and will leave the player with if it drains completely.

Hard: Hostile mobs spawn, and deal greater damage than on Normal difficulty. The hunger bar can deplete and the player will starve to death if it drains completely. Zombies can break through wooden doors and can spawn reinforcements when attacked. Spiders can spawn with status effects.

Hardcore gamemode
Hardcore causes the player to spawn in Hard difficulty and does not allow it to be changed. In single player, if the player dies, the player can choose to respawn in spectator mode or delete the world. In Multiplayer, if a player dies they are automatically banned from the server.

Moon phase
The phase of the moon has effects on the spawning of slimes in swamp biomes, and contributes to the calculation of regional difficulty. The fuller the moon is, the greater the effect. Note that the moon does not actually have to be out for this effect to take place—the effect of the moon's phase exists even at daytime.

Regional difficulty
Regional difficulty is a variation in difficulty calculated based on several factors, including the “inhabited time" of the current chunk, the total play time in the world, the phase of the moon, and the current difficulty setting. The current regional difficulty is shown on the Debug screen as “Local Difficulty".

The “inhabited time" of a chunk increases for each tick a player spends with the chunk loaded. This is a cumulative measure of time—if 50 players spend a single hour in a chunk, it counts the same as if one player spent 50 hours there. The effect of inhabited time on regional difficulty is capped at 50 hours.

Total play time in the world also contributes to regional difficulty. This effect doesn't begin until after the first hour of play time and is capped at 21 hours.

In pseudocode, the calculation of regional difficulty is: TotalTimeFactor, ChunkFactor, and RegionalDifficulty are floating-point variables MoonPhase is as in the table above.

if ( TotalPlayTime > 21 hours ) TotalTimeFactor = 0.25 else if ( TotalPlayTime < 1 hour ) TotalTimeFactor = 0 else TotalTimeFactor = ( TotalPlayTimeInTicks - 72,000 ) / 5,760,000

if ( ChunkInhabitedTime > 50 hours ) ChunkFactor = 1 else ChunkFactor = ChunkInhabitedTimeInTicks / 3,600,000 if (difficulty is not Hard) multiply ChunkFactor by 3/4

if ( MoonPhase / 4 > TotalTimeFactor ) add TotalTimeFactor to ChunkFactor else add MoonPhase / 4 to ChunkFactor

if ( difficulty is Easy ) divide ChunkFactor by 2

RegionalDifficulty = 0.75 + TotalTimeFactor + ChunkFactor

if (difficulty is Normal) multiply RegionalDifficulty by 2 if (difficulty is Hard) multiply RegionalDifficulty by 3

return RegionalDifficulty

The regional difficulty ranges from 0.75–1.5 on easy, 1.5–4.0 on normal, and 2.25–6.75 on hard.

When actually used in the game, this raw number is usually converted to a value in the range 0.0–1.0 as follows: if ( RegionalDifficulty < 2.0 ) { value = 0.0; } else if ( RegionalDifficulty > 4.0 ) { value = 1.0; } else { value = ( RegionalDifficulty - 2.0 ) / 2.0; }

Thus, on easy, regional difficulty will have no effect; on normal the effects will reach the maximum after 21 hours of play time in a fully-inhabited chunk on a full moon; and on hard after 21 hours of play time the effects will reach the maximum in chunks inhabited only $4 1/6$ hours during a full moon and will remain at maximum in chunks inhabited over $16 2/3$ hours.