Pig

Pigs are common passive mobs that spawn in the Overworld. They drop porkchops upon death, and can be ridden with saddles.

Spawning
Pigs spawn on grass blocks at the surface at a light level of 9 or more. Herds of 4 pigs spawn upon world generation. Like other farm animals, they do not spawn in snowy tundras, but can still spawn in snowy taigas.

Bedrock Edition
They spawn in herds of 1-3 at light level 7 or above. 5% of them spawn as piglets.

Villages
Pigs spawn in stables and in butcher houses backyard in villages.

Drops
When killed, an adult pig drops:
 * 1–3 ( if killed while on fire). The maximum amount is increased by 1 per level of Looting, for a maximum of 1-6 with Looting III.
 * 1 if saddled
 * 1–3 experience if killed by a player or tamed wolf

Like other baby animals, killing a baby pig yields no items, nor experience.

Behavior
Pigs typically appear the Overworld in groups of 4. They randomly oink.

Pigs move similarly to other passive mobs; they wander aimlessly, and avoid lava and cliffs high enough to cause fall damage. They make no attempt to stay out of water, bobbing up and down to stay afloat. When they encounter obstacles, pigs often hop up and down, apparently attempting to jump over them regardless of whether it is possible. Pigs can be pushed into minecarts and transported by rail.

Pigs follow any player carrying a carrot, carrot on a stick, potato, or beetroot, and stops following if the player moves farther than approximately 8 blocks away from the pig.

When a pig is struck by lightning or hit by a trident with the Channeling enchantment during a thunderstorm, it transforms into a zombie pigman. If the pig was equipped with a saddle, the saddle is lost, and a mounted player is ejected.

Breeding
Pigs can be bred using carrots, potatoes, and beetroots. It takes about 5 minutes before the parents can be bred again, as with all farm animals. It takes at least one full Minecraft 'day' (20 minutes) for piglets to mature. The appearance of a piglet is roughly similar to that of an adult pig, having the same sized heads, but noticeably smaller bodies. Piglets stay near their parents until they mature, although the parents cannot protect them from harm.

Feeding a baby pig reduces the remaining time for it to mature by 10% per food item.

Riding pigs
Saddled pigs are controllable with a carrot on a stick. They start slow but end up going 5.20 m/s. Pigs can be controlled through 1-block-high bodies of water with a carrot and stick, but deeper water causes the player to dismount. the carrot on a stick while riding a pig takes 7 durability from the carrot and stick. Damage is taken by the part that was hit; fall damage is taken by the pig. Falling does not cause any knockback or decrease movement speed.

Data values
Pigs have entity data associated with them that contain various properties of the mob.

Trivia

 * Pigs are the oldest existing passive mobs in the game.
 * Saddled pigs in minecarts behave strangely:
 * If the player mounts the pig and uses the opposite controls for direction, the speed of the minecart is boosted to the same speed as a minecart travelling on powered rails.
 * The minecart, ridden or not, does not come to a stop unless it hits a block. Other entities and unpowered powered rails will only slow it to a minimum speed.
 * If a player sits on a saddled pig in a minecart that isn't on a track, the minecart can be driven like a car (although it is very slow).
 * Quitting the game while boosting a ridden pig causes the pig to move always at boosted speed.
 * The house-music artist deadmau5 released a song titled "Get In The Cart, Pig" (later named "Fn Pig"), in a direct reference to Minecraft.
 * You can still see a pig's saddle when it is under the effect of Invisibility.
 * When led with carrots, pigs seem to "forget" their pathfinding skills: they often become stuck on the opposite side of a block rather than walking around it, and can blindly walk off of ledges or into fire.
 * Frost Walker still works on water while riding a pig.
 * You can enter a cave with a 1 block size entrance by riding a pig.