Slime

A slime is a hostile mob in the shape of a green cube in various sizes. They have relatively weak AI compared to most other mobs' pathfinding systems, and will always try to move directly toward players without regard for obstacles or hazards. When killed, a slime will split into smaller slimes. When the smallest slimes are killed, they will drop slimeballs.

Behavior
In Minecraft, only sizes 1, 2, and 4 spawn naturally, and with equal probability. With use of, slimes can potentially range from size 1 to 256.

Slimes move by hopping, which they will do each 10 to 30 ticks ($1⁄2$ to $1 1⁄2$ seconds). Their exact routine is as follows:

The Slime will search for a player within 16 blocks (spherical) distance.
 * If no players are found, they wait 10 to 30 ticks ($1/2$ to $1 1/2$ seconds). Then they will change direction, by a random amount up to 57.26° (1 radian) left or right, jump, and repeat the process.
 * If a player is found, the delay before jumping will be $1⁄3$ as long (3 to 10 ticks), and the Slime's direction will be set directly toward the nearest player before jumping.

Combat
A slime's health is equal to their size squared, and its dimensions are 0.6 blocks times its size in each dimension. When a slime attacks, it will deal damage equal to its size, except for size 1 (smallest) slimes, which cannot do damage.

A slime's jump distance also depends on their size; a slime will jump a distance slightly farther than its length. This means that a size 4 slime will move significantly quicker with each jump than a size 2 slime, while a size 1 (tiny) slime will move at an extremely slow speed.

When the player kills a slime and the slime's size is larger than 1, it will die and spawn 2-4 new slimes equivalent to its size divided by 2, rounding down.

Slimes also have an odd attack interval: that is, their attack speed is twice that of other melee-combat mobs. Mobs like zombies and spiders attack at a rate of one hit per second, while slimes attack at a rate of two hits per second. Essentially, this means a size 4 slime will deal four hearts of damage per second on normal difficulty, dealing two hearts every half-second.

Drops
If the slime's size is 1, it will drop 0-2 slimeballs. If it is larger, it will only drop experience. All slimes drop experience equal to their size. The slime balls can be used for many different crafting recipes such as sticky pistons, leads, and slime blocks.

Spawning
Slimes spawn in areas below layer 40, and also spawn on the surface of swamps during the night, depending on the phase of the moon. In Superflat type worlds, the spawn rate is decreased.

Swamps
In swamps, slimes may spawn at night between the heights of 50 and 70 provided the light level is 7 or less. They spawn most often on a full moon, and never on a new moon. This can make gathering slimeballs difficult, as it takes over two hours for the moon to completely cycle.

More precisely, the game checks if the light level is equal to or less than a random integer (from 0 to 7), then if the fraction of the moon which is bright is greater than a random number (from 0 to 1). If these conditions are met and the altitude is acceptable, there is a 50% chance of spawning a slime.

Low layers
Slimes spawn throughout the world (except mushroom islands) below layer 40, but only in certain chunks, 1 in 10 of all chunks. However, in these chunks and layers, they spawn regardless of light level. The "slime chunks" are determined pseudo-randomly by combining their chunk coordinates with the seed of the world. Tools exist to calculate which chunks are slime chunks—see Slime finding tools.

One in 10 of chunks will be able to spawn slimes underground, based on the formula: Random rnd = new Random(seed +                        (long) (xPosition * xPosition * 0x4c1906) +                         (long) (xPosition * 0x5ac0db) +                          (long) (zPosition * zPosition) * 0x4307a7L +                         (long) (zPosition * 0x5f24f) ^ 0x3ad8025f); return rnd.nextInt(10) == 0;

That is, using the chunk coordinates to help generate a seed, a random number between 0 and 9 will be generated, and if that number is 0, the chunk will be able to spawn slimes. To convert world coordinates to chunk coordinates, divide by 16 and round down.

Like most other mobs, Slimes require two vertical non-opaque blocks (e.g., air, signs, torches) to spawn in, with an opaque block underneath. The space they spawn in must also be clear of solid obstructions and liquids. big slimes require a 3x2.5x3 space to spawn (that is, between a floor that allows spawning with a top slab over two non-opaque blocks), small slimes require a 3x2x3 space, and tiny slimes require a 1x2x1 space (or 1x1x1 if the upper block is not opaque). Slimes are equally likely to spawn at all sizes. Slimes are much more likely to spawn in a 3 high room.

Big slimes can spawn in a 2.5 high space and can move, though very slowly and noisily, in such a space (unlike Wither Skeletons, which cannot move if they spawn in such conditions).

Slimes spawn only 1/10th as often as other hostile mobs, so unless a swamp biome is nearby, they can be hard to find. Slimes in low levels can spawn in any light level and lighting does not affect their spawn rate. However, lighting up the surrounding area does decrease the chances of non-slime mobs spawning, and thus indirectly increases slime spawning rates. Glowstone has the same properties as glass, so mobs cannot spawn on it.

Like other hostile mobs, slimes will not spawn within 24 meters (spherical) of any player, and will despawn over time if no player is within 32 meters and instantly if no player is within 128 meters.

Farming


Once a slime spawning chunk has been determined the process of encouraging slime spawning is relatively simple. The player can clear out large rooms - typically 3 x 3 x 3 or larger (but for maximum efficiency clear out the entire chunk - 16 x 3 x 16). It might be wise to light these rooms to prevent other hostile mobs from spawning. Waiting for slimes to spawn in these rooms can be lengthy at times, however. Killing slimes with either the use of fire or water is recommended. See Slime Spawning for more information on how to increase this rate.

Pre-1.4 spawning
The (pre-1.4) slime spawning algorithm is discussed in greater detail in this forum topic, but note that the algorithm has changed many times and older information may no longer be accurate.

Trivia



 * Slimes may have been inspired by a number of classic gaming monsters. Their shape and size resemble that of Gelatinous Cubes from Dungeons & Dragons (though admittedly that comes more from Minecraft's cubic art design), while their splitting behavior resembles that of Zols and Chuchus from The Legend of Zelda, Puddings from Nethack and Amoeboids from Ratchet and Clank. The name and the large, cartoonish face may be a homage to Yuji Horii's iconic Slimes from the Dragon Quest series.
 * Slimes do not prevent you from sleeping.
 * Tiny slimes have the least amount of health of any mob in the game, with only . Because of this some players refuse to waste sword durability on small slimes, preferring to use an empty hand or a block.
 * Because there is a limit on the number of hostile mobs that can exist in all the loaded chunks at once, splitting several slimes into tiny slimes and letting them follow the player will greatly reduce the chances of encountering other monsters.
 * Slimes will only attack the player, even if a skeleton accidentally shoots it.
 * Part of the slime coding allows tiny slimes to spawn on Peaceful, but the natural spawning algorithm skips hostile spawning entirely on Peaceful. As a result, tiny slimes cannot spawn. However, there are illegitimate ways to spawn the slimes on Peaceful, e.g. with a slime Monster Spawner.
 * Slimes hop much faster when pursuing a player.
 * Despite Slimes being hostile mobs, many players have tiny Slimes as pets since they follow and can't directly damage players.
 * From one large slime, the maximum experience a player can get from killing it and all the slimes that split from it is 28 XP; 4 XP from the largest, 8 XP from the 4 it splits into, and 16 XP from the 4 each of those split into.
 * To calculate the health of a slime, the formula is.
 * So a slime with size 127 has a total of
 * the same applies to magma cube.
 * The new Slime Block in 14w02a has a similar texture to the outside of a slime.
 * Prior to update 1.8, slimes jumped in a zigzag path when persuing a player. After 1.8, they now jump in a perfectly straight line.