Experience Orb

An Experience Orb is an entity that can be collected for experience points. They appear as an orb that fades between a green and yellow color.

Behavior
Experience orbs drop when a killed mob's corpse vanishes (unlike dropped resources which appear at death), as well as when mining ores (other than gold and iron, as the player could continuously replace and re-mine the block for infinite experience) and when using a furnace to smelt iron, gold, clay, foods, wood(to make charcoal), and possibly other items. Upon the player's death, he or she loses all accumulated experience points, reverting back to level 0. Accumulated experience orbs will drop as well. Experience orbs earned from defeating enemies will only drop if the mob has been killed by the player, as opposed to a mob grinder.

Experience Orbs vary in value, depending on what dropped them. Orbs dropped by mobs are often worth one to three experience, while orbs dropped by a high level player (in SMP - PvP) may be worth tens or even hundreds of points, depending on how high a level the player was. The general worth of an orb is reflected by its size, but the size does not increase much per point, and not at all past a certain extent.

When a player is within a 4 to 5 block range from an orb, the orb will be drawn toward the player and fly around them of its own accord, and will finally be consumed by the player, adding experience points to the player. Unlike resources, experience points are picked up gradually: no matter how many orbs are in range of the player, they will be added to the player's experience one at a time. In extreme cases, this can result in the player being followed by a swarm of orbs for many seconds. If an experience orb isn't collected within 5 minutes of its appearance, it will disappear.

Dropping experience orbs
In general, mobs drop experience orbs if they were killed by the player, but some of the damage can be done by other means. Specifically, a mob will drop orbs if it was hit by a player or tamed wolf, within the last 3 seconds (60 ticks) before its death. This allows for monsters set on fire by the player (or attacked while burning in the sun), knocked off cliffs, or knocked into traps to still drop experience orbs. It also allows for "mob grinders" that reduce mobs to a few hit points, then let the player deal the killing blow. Arrows and thrown potions (or fire charges) count. Things that don't count as player attacks: Fall damage, suffocation, drowning, fire and lava, golems, anything from dispensers. A Ghast killed by its own rebounded fireball will drop orbs, but not if it was another Ghast's fireball. If a mob dies in or near lava or standing flame, then even if it was attacked by the player, some or all of the orbs may be destroyed.

History
In an image of the new lighting system, a small yellow (the orb was yellow due to a warm light from a torch) spherical shape can be seen on the left side of the screen, but a day after the photo was published Notch claimed it had an error and posted a new one, this time, without a yellow sphere. In a later tweet, Notch showed a picture of a Beta 1.7 change-list (back then the adventure update was supposed to be in beta 1.7). Although it was completely blurred out and was, at first, thought of as a joke, but then Notch stated that one of the pictures with the new lighting system and the change list had a secret in them, and people all around the web started speculating.

One place that people discussed it was on the Minecraft forums, where it was discovered that the tabs at the top of the change list that were partly covered, could be decoded based on the 2 pixel tall pattern available in the image.

After a user named "tmcaffeine" successfully decoded it, the tabs read: ExperienceOrb.java, changelist.txt, Level.java, Tile.java, HugeMushroomTile.java, HugeMushroomFeature.java, RandomLevelSource(cut)

Bugs

 * In Beta 1.9 Pre-release 4, in areas of light level 0, dropped experience orbs appear black.
 * The new sound for collecting experience orbs does not play in SMP (version 1.0.0.) but instead, plays the usual pickup sound. (Since snapshot 12w05a the experience orbs DO make the sound in SMP, but it's pitched higher than in SSP.)
 * In multiplayer, experience points do not drop when a player dies. (Although in singleplayer, this has been found to happen too.)
 * If a player has more than 11 levels of experience upon death, they will only be able to pick up 11 levels worth.
 * Oftentimes, especially in SMP, experience orbs will not be picked up by the player as they move and will appear to "orbit" around the player.The only way to fix this glitch is to let someone else "steal" them or to stand still and let them be collected(though sometimes you will have to move in order to pick them up)
 * Experience orbs can fall through connected fences, unlike other entities.

Trivia

 * Although mob drops spawn the instant the final blow is dealt to the mob, experience orbs do not until the mob entity disappears and the smoke appears.
 * Experience orbs pulled towards a player are slowed by spider webs.
 * Experience orbs can be destroyed by fire, lava, explosions and cacti just like dropped items.
 * Experience orbs will despawn after five minutes, in a similar fashion to dropped items.
 * Experience orbs can trigger pressure plates and tripwires, allowing for location sensitive contraptions.
 * When a player takes on many orbs at once they begin orbiting its head.
 * When a player picks up an experience orb from a Bottle o' Enchanting while riding on a minecart, the minecart will stop instantly (1.2.5 Creative).
 * By using an Inventory editor, you may create a "Spawn Experience Orb" egg, the ID being 383:2, although it will not actually spawn orbs.
 * If you use the server command "/xp (number of orbs to give) (your name) the maximum orbs you can give using the command are 5000 orbs. Giving yourself more orbs than this results in the error: "The number you have entered (number of orbs you entered) is too big, it must be at most 5000"
 * 32767 is the highest level of experience you can possibly get. Getting more than this results in an empty experience bar. 1,879,212,031 is the maximum amount of orbs.