Difficulty

Difficulty can be toggled via the options menu in Minecraft. Changing this option has a direct impact in the gameplay itself. There are currently four difficulties in the game: Peaceful, Easy, Normal and Hard

When the difficulty is set to Peaceful, hostile mobs don't spawn naturally (with the exception of the Ender Dragon), and don't deal damage. The player cannot spawn a Wither. When hostile mobs spawn from spawners, they are removed from the game instantaneously. Players regain health over time. Despite regaining health over time, it is still possible to die if damage is received quickly enough. Switching from any other difficulty setting to Peaceful results in existing hostile mobs, except for hostile wolves and iron golems, being removed from the world. The Food Bar never depletes and players cannot eat anything except Golden Apples, unless the player has switched to Peaceful when their Food Bar was below the maximum. If it is below the maximum, it quickly regenerates.

Hostile mobs spawn in Easy difficulty. Enemies deal less damage than on Normal difficulty. Creepers will cancel their explosions after moving only a short distance away. The Food 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.

On Normal difficulty, hostile mobs spawn. Enemies deal standard damage. The Food Bar can deplete and will leave the player with if it drains completely.

On Hard difficulty, hostile mobs also spawn. Enemies deal greater damage than on Normal difficulty. The Food Bar can deplete and will slowly kill the player if it drains completely. Creepers will not cancel their attack unless a large distance is between them and the player, making the explosion much harder to avoid. Zombies break through wooden doors. Spiders can spawn with potion effects.

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.

Each difficulty setting has an associated multiplier: easy is 1, normal is 2, and hard is 3.

In pseudocode, the calculation of regional difficulty is: hard = ( Difficulty == HARD ); f1 = 0.75;

// DayTime is the total play time from level.dat f2 = minmax( ( DayTime + -72000 ) / 1440000, 0.0, 1.0 ) * 0.25; f1 += f2;

f3 = 0.0; f3 += minmax( InhabitedTime / 3600000, 0.0, 1.0 ) * ( hard ? 1.0 : 0.75 ); f3 += minmax( MoonPhase * 0.25, 0.0, f2 ); if ( Difficulty == EASY ) { f3 *= 0.5; } f1 += f3;

return DifficultyMultiplier * f1;

The maximum regional difficulty is 1.5 on easy, 4 on normal, and 6.75 on hard.

When actually used in the game, this raw number is 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.

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 world is deleted. In Multiplayer, if a player dies they are automatically banned from the server.

Trivia

 * Notch made a tweet on October 22nd 2010, stating that he's "changing difficulty to realism. Lowest setting = creative. Highest setting = starve". This was never implemented, however "hardcore" mode was added along with a creative gamemode.