Difficulty



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

World setting


There are four difficulty levels in the game: Peaceful, Easy, Normal and Hard. These can be set in the settings, as well as by the command.

Peaceful
No hostile mobs can spawn naturally, except shulkers and the ender dragon, which do not deal damage. Also, no spiders, cave spiders, zombie pigmen or endermen – neutral rather than hostile mobs – can spawn naturally. When any of these 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 and the neutral mobs listed above, except for shulkers and the ender dragon, and except for neutral mobs currently hostile to the player such as polar bears, wolves, iron golems. Wolves and polar bears will still remain hostile to the player, though will be unable to inflict damage; llamas can still damage the player. 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 and chorus fruits, unless the player has switched to Peaceful when their hunger bar was below the maximum. Additionally, If the hunger bar 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 mode
At the world creation screen, selecting Hardcore from among the game mode options causes the player to spawn in Hard difficulty, does not allow it to be changed, and only allows the player one life. In a single player world, 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 in the sky for this effect to take place—the effect of the moon's phase exists even in the daytime, and in any dimension.

Regional difficulty


Regional difficulty or local difficulty is a value between 0.00 and 6.75 that the game calculates by considering not just the world difficulty setting, but also the inhabited time of a chunk, the total play time in the world, and the phase of the moon. This value is shown on the debug screen as the first value listed after the heading "Local Difficulty". This value determines several aspects of the difficulty of gameplay (see below).

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.

The total play time in the world is a factor which 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 raw regional difficulty therefore ranges from 0.75–1.5 on Easy, 1.5–4.0 on Normal, and 2.25–6.75 on Hard.

Clamped regional difficulty
The clamped regional difficulty is a value between 0.00 and 1.00 based on regional difficulty. This value is shown on the debug screen as the second value listed after the heading "Local Difficulty". This is yet another value that affects the difficulty of gameplay (see below).

The regional difficulty value is clamped 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, where regional difficulty is never higher than 1.5, the clamped value will always be zero.

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.