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). 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
The following instances determine whether a mob drops experience upon death. In general - mobs drop experience orb if they were killed by the player. Note that only the killing blow counts - a mob can be damaged to near-death by environmental damage, but if the final blow was dealt by a player, the mob drops orbs. This allows for "Kill Stealing" or "Weathering Down" mobs for easy experience. Unlike when a Item drops it drops where the mob/player died, an Experience Orb will drop where the corpse of the mob/player ends up.


 * Death by Fire/ Lava - Mobs will not drop orbs if killed by fire, lava or burning.
 * However, if the mob was ignited by an enchanted sword or bow, and the following burning damage kills the mob, it will drop orbs.
 * Snowball - Applicable to Blazes and Enderdragons only. If the final damage is dealt from a snowball thrown by the player, orbs will drop. However, if a Snow Golem deals the final blow with a snowball, orbs will not drop.
 * Suffocation - Mobs will not drop orbs if suffocated by a solid block
 * Drowning - Mobs will not drop orbs if they run out of air underwater.
 * Fall Damage - Mobs will not drop orbs if they fall to their deaths.
 * However, if the player damaged the mob (by any other method that counts in this list) before it hits the ground and it dies from fall damage, it will drop orbs. This includes using knockback or sprint attacks to send a mob off a fatal drop.
 * Melee - Mobs will drop orbs if they are killed by any player's melee attack.
 * In the instance of a mob brawl (when mobs attack each other), mobs will not drop orbs.
 * In the instance of a player's wolf dealing the last damage, mobs will drop orbs.
 * Ranged - Mobs will drop orbs if killed by an arrows fired from a player's bow.
 * Mobs killed by dispensers will not drop orbs.
 * In the instance of a mob brawl, a skeleton's arrow will not cause a mob to drop orbs.
 * A Snow Golem's snowballs will not cause a mob to drop orbs
 * Alchemy/Potions - Mobs will drop orbs if killed by instant damage potions thrown by the player
 * However, instant damage potions fired from dispensers won't cause mobs to drop orbs
 * Explosion - Mobs will not drop orbs if killed by TNT, Creeper Explosions, Ghast Fireballs or by Blaze Fireballs
 * However, a Ghast killed by its own rebounded fireball will drop orbs, but not if it was another Ghast's fireball.
 * Void - It is likely that mobs will not drop orbs in the Void, as the killing blow is never dealt by the player. However, this will not matter since the orbs wouldn't be obtainable in regular gameplay.

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, 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 (your name) (number of orbs to give) the maximum orbs you can give using the command are 2147483647 orbs. Giving yourself more orbs than this results in the error: "Invalid exp count"
 * 32767 is the highest level of experience you can possibly get. Getting more than this results in an empty experience bar.