Index: Chunk.cpp
===================================================================
--- Chunk.cpp	(revision 1592)
+++ Chunk.cpp	(working copy)
@@ -2478,6 +2478,18 @@
 
 
 
+void cChunk::BroadcastExperienceOrb(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, short a_Amount)
+{
+	for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
+	{
+		(*itr)->SendExperienceOrb(a_Entity, a_RelX, a_RelY, a_RelZ, a_Amount);
+	}  // for itr - LoadedByClient[]
+}
+
+
+
+
+
 void cChunk::BroadcastEntVelocity(const cEntity & a_Entity, const cClientHandle * a_Exclude)
 {
 	for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
Index: Chunk.h
===================================================================
--- Chunk.h	(revision 1592)
+++ Chunk.h	(working copy)
@@ -235,6 +235,7 @@
 	void BroadcastAttachEntity       (const cEntity & a_Entity, const cEntity * a_Vehicle);
 	void BroadcastPlayerAnimation    (const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude = NULL);
 	void BroadcastEntityEquipment    (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item, const cClientHandle * a_Exclude = NULL);
+	void BroadcastExperienceOrb      (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, short a_Amount);
 	void BroadcastEntVelocity        (const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
 	void BroadcastEntRelMoveLook     (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude = NULL);
 	void BroadcastEntRelMove         (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude = NULL);
Index: ChunkMap.cpp
===================================================================
--- ChunkMap.cpp	(revision 1592)
+++ ChunkMap.cpp	(working copy)
@@ -385,6 +385,23 @@
 
 
 
+
+void cChunkMap::BroadcastExperienceOrb(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, short a_Amount)
+{
+	cCSLock Lock(m_CSLayers);
+	cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ());
+	if (Chunk == NULL)
+	{
+		return;
+	}
+	// It's perfectly legal to broadcast packets even to invalid chunks!
+	Chunk->BroadcastExperienceOrb(a_Entity, a_RelX, a_RelY, a_RelZ, a_Amount);
+}
+
+
+
+
+
 void cChunkMap::BroadcastEntRelMoveLook(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude)
 {
 	cCSLock Lock(m_CSLayers);
Index: ChunkMap.h
===================================================================
--- ChunkMap.h	(revision 1592)
+++ ChunkMap.h	(working copy)
@@ -58,6 +58,9 @@
 	void BroadcastEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item, const cClientHandle * a_Exclude = NULL);
 	
 	/// Broadcasts a EntVelocity packet to all clients in the chunk where a_Entity is. Velocity is measured in blocks/second
+	void BroadcastExperienceOrb(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, short a_Amount);
+
+	/// Broadcasts a EntVelocity packet to all clients in the chunk where a_Entity is. Velocity is measured in blocks/second
 	void BroadcastEntVelocity(const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
 
 	/// Broadcasts a RelEntMoveLook packet to all clients in the chunk where a_Entity is
Index: ClientHandle.cpp
===================================================================
--- ClientHandle.cpp	(revision 1592)
+++ ClientHandle.cpp	(working copy)
@@ -1473,6 +1473,15 @@
 
 
 
+void cClientHandle::SendExperienceOrb(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ, short a_Amount)
+{	
+	m_Protocol->SendExperienceOrb(a_Entity, a_BlockX, a_BlockY, a_BlockZ, a_Amount);
+}
+
+
+
+
+
 void cClientHandle::SendEntHeadLook(const cEntity & a_Entity)
 {
 	ASSERT(a_Entity.GetUniqueID() != m_Player->GetUniqueID());  // Must not send for self
Index: ClientHandle.h
===================================================================
--- ClientHandle.h	(revision 1592)
+++ ClientHandle.h	(working copy)
@@ -93,6 +93,7 @@
 	void SendDisconnect         (const AString & a_Reason);
 	void SendEntHeadLook        (const cEntity & a_Entity);
 	void SendEntLook            (const cEntity & a_Entity);
+	void SendExperienceOrb      (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ, short a_Amount);
 	void SendEntVelocity        (const cEntity & a_Entity);
 	void SendEntRelMove         (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ);
 	void SendEntRelMoveLook     (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ);
Index: Entity.h
===================================================================
--- Entity.h	(revision 1592)
+++ Entity.h	(working copy)
@@ -68,6 +68,7 @@
 		etFallingBlock,
 		etMinecart,
 		etTNT,
+		etExperienceOrb,
 		
 		// DEPRECATED older constants, left over for compatibility reasons (plugins)
 		eEntityType_Entity = etEntity,
@@ -91,6 +92,7 @@
 	bool IsPickup  (void) const { return (m_EntityType == etPickup); }
 	bool IsMob     (void) const { return (m_EntityType == etMob); }
 	bool IsMinecart(void) const { return (m_EntityType == etMinecart); }
+	bool IsTNT     (void) const { return (m_EntityType == etTNT); }
 	
 	/// Returns true if the entity is of the specified class or a subclass (cPawn's IsA("cEntity") returns true)
 	virtual bool IsA(const char * a_ClassName) const;
Index: ExperienceOrb.cpp
===================================================================
--- ExperienceOrb.cpp	(revision 0)
+++ ExperienceOrb.cpp	(working copy)
@@ -0,0 +1,46 @@
+#include "Globals.h"
+
+#include "ExperienceOrb.h"
+#include "World.h"
+#include "ClientHandle.h"
+
+
+
+
+cExperienceOrb::cExperienceOrb(int a_X,int a_Y,int a_Z) :
+	super(etExperienceOrb, a_X + 0.5f, a_Y + 0.5f, a_Z + 0.5f)
+{
+}
+
+
+
+
+void cExperienceOrb::Initialize(cWorld * a_World)
+{
+	super::Initialize(a_World);
+	a_World->BroadcastSpawn(*this);
+}
+
+
+
+
+
+void cExperienceOrb::SpawnOn(cClientHandle & a_ClientHandle)
+{
+	a_ClientHandle.SendSpawnObject(*this,2,1,0,0); //2 means ExperienceOrb
+	m_bDirtyPosition = false;
+	m_bDirtySpeed = false;
+	m_bDirtyOrientation = false;
+	m_bDirtyHead = false;
+}
+
+
+
+
+
+void cExperienceOrb::Tick(float a_Dt, cChunk & a_Chunk)
+{
+	LOGD("Test");
+	super::Tick(a_Dt,a_Chunk);
+	BroadcastMovementUpdate();
+}
\ No newline at end of file
Index: ExperienceOrb.h
===================================================================
--- ExperienceOrb.h	(revision 0)
+++ ExperienceOrb.h	(working copy)
@@ -0,0 +1,23 @@
+
+#pragma once
+
+#include "Entity.h"
+#include "Defines.h"
+
+
+
+
+
+class cExperienceOrb :
+	public cEntity
+{
+	typedef cEntity super;
+public:
+	CLASS_PROTODEF(cExperienceOrb);
+
+	cExperienceOrb(int a_X,int a_Y,int a_Z);
+
+	virtual void Initialize(cWorld * a_World) override;
+	virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
+	virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
+};
\ No newline at end of file
Index: Mobs/Monster.cpp
===================================================================
--- Mobs/Monster.cpp	(revision 1592)
+++ Mobs/Monster.cpp	(working copy)
@@ -10,6 +10,7 @@
 #include "../Defines.h"
 #include "../MonsterConfig.h"
 #include "../MersenneTwister.h"
+#include "../ExperienceOrb.h"
 
 #include "../Vector3f.h"
 #include "../Vector3i.h"
@@ -203,6 +204,9 @@
 {
 	super::KilledBy(a_Killer);
 	if(m_SoundHurt != "") m_World->BroadcastSoundEffect(m_SoundDeath, (int)(GetPosX() * 8), (int)(GetPosY() * 8), (int)(GetPosZ() * 8), 1.0f, 0.8f);
+	cExperienceOrb *XP = new cExperienceOrb( (int)(GetPosX()), (int)(GetPosY()), (int)(GetPosZ()) );
+	XP->Initialize(m_World);
+	m_World->BroadcastExperienceOrb( XP, (int)(GetPosX() * 8), (int)(GetPosY() * 8), (int)(GetPosZ() * 8), 2 );
 	m_DestroyTimer = 0;
 }
 
Index: Player.cpp
===================================================================
--- Player.cpp	(revision 1592)
+++ Player.cpp	(working copy)
@@ -901,8 +901,9 @@
 		/* Add player to all the necessary parts of the new world */
 		SetWorld( World );
 		GetWorld()->AddPlayer(this);
-		GetClientHandle()->StreamChunks();
 
+		m_ClientHandle->HandleRespawn();
+		m_ClientHandle->StreamChunks();
 		return true;
 	}
 
@@ -913,6 +914,17 @@
 
 
 
+void cPlayer::SetOnFire( float a_FireDamageInterval, float a_BurnPeriod)
+{
+	SetMetaData(BURNING);
+	m_BurnPeriod = a_BurnPeriod;
+	m_FireDamageInterval = a_FireDamageInterval;
+}
+
+
+
+
+
 void cPlayer::LoadPermissionsFromDisk()
 {
 	m_Groups.clear();
Index: Player.h
===================================================================
--- Player.h	(revision 1592)
+++ Player.h	(working copy)
@@ -103,6 +103,7 @@
 
 	void SendMessage(const AString & a_Message);
 
+	void SetOnFire( float a_FireDamageInterval, float a_BurnPeriod); // tolua_export
 	const AString & GetName(void) const { return m_PlayerName; }
 	void SetName(const AString & a_Name) { m_PlayerName = a_Name; }
 	
@@ -228,7 +229,6 @@
 	
 	bool m_IsCrouched;
 
-
 	virtual void Destroyed(void);
 
 	/// Filters out damage for creative mode
Index: Protocol/Protocol.h
===================================================================
--- Protocol/Protocol.h	(revision 1592)
+++ Protocol/Protocol.h	(working copy)
@@ -67,6 +67,7 @@
 	virtual void SendEntRelMoveLook     (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) = 0;
 	virtual void SendEntityEquipment    (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) = 0;
 	virtual void SendEntityStatus       (const cEntity & a_Entity, char a_Status) = 0;
+	virtual void SendExperienceOrb      (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ, short a_Amount) = 0;
 	virtual void SendExplosion          (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, cVector3iArray a_BlocksAffected, const Vector3d & a_PlayerMotion) = 0;
 	virtual void SendGameMode           (eGameMode a_GameMode) = 0;
 	virtual void SendHealth             (void) = 0;
Index: Protocol/Protocol125.cpp
===================================================================
--- Protocol/Protocol125.cpp	(revision 1592)
+++ Protocol/Protocol125.cpp	(working copy)
@@ -55,6 +55,7 @@
 	PACKET_COLLECT_PICKUP            = 0x16,
 	PACKET_SPAWN_OBJECT              = 0x17,
 	PACKET_SPAWN_MOB                 = 0x18,
+	PACKET_SPAWN_EXPERIENCE_ORB      = 0x1a,
 	PACKET_ENTITY_VELOCITY           = 0x1c,
 	PACKET_DESTROY_ENTITY            = 0x1d,
 	PACKET_ENTITY                    = 0x1e,
@@ -277,6 +278,22 @@
 
 
 
+
+void cProtocol125::SendExperienceOrb(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ, short a_Amount)
+{
+	cCSLock Lock(m_CSPacket);
+	WriteByte(PACKET_SPAWN_EXPERIENCE_ORB);
+	WriteInt(a_Entity.GetUniqueID());
+	WriteInt(a_BlockX);
+	WriteInt(a_BlockY);
+	WriteInt(a_BlockZ);
+	WriteInt(a_Amount);
+	Flush();
+}
+
+
+
+
 void cProtocol125::SendEntVelocity(const cEntity & a_Entity)
 {
 	ASSERT(a_Entity.GetUniqueID() != m_Client->GetPlayer()->GetUniqueID());  // Must not send for self
Index: Protocol/Protocol125.h
===================================================================
--- Protocol/Protocol125.h	(revision 1592)
+++ Protocol/Protocol125.h	(working copy)
@@ -39,6 +39,7 @@
 	virtual void SendDisconnect         (const AString & a_Reason) override;
 	virtual void SendEntHeadLook        (const cEntity & a_Entity) override;
 	virtual void SendEntLook            (const cEntity & a_Entity) override;
+	virtual void SendExperienceOrb      (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ, short a_Amount);
 	virtual void SendEntVelocity        (const cEntity & a_Entity) override;
 	virtual void SendEntRelMove         (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override;
 	virtual void SendEntRelMoveLook     (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override;
Index: Protocol/ProtocolRecognizer.cpp
===================================================================
--- Protocol/ProtocolRecognizer.cpp	(revision 1592)
+++ Protocol/ProtocolRecognizer.cpp	(working copy)
@@ -198,6 +198,15 @@
 
 
 
+void cProtocolRecognizer::SendExperienceOrb(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ, short a_Amount)
+{
+	ASSERT(m_Protocol != NULL);
+	m_Protocol->SendExperienceOrb(a_Entity, a_BlockX, a_BlockY, a_BlockZ, a_Amount);
+}
+
+
+
+
 void cProtocolRecognizer::SendEntVelocity(const cEntity & a_Entity)
 {
 	ASSERT(m_Protocol != NULL);
Index: Protocol/ProtocolRecognizer.h
===================================================================
--- Protocol/ProtocolRecognizer.h	(revision 1592)
+++ Protocol/ProtocolRecognizer.h	(working copy)
@@ -67,6 +67,7 @@
 	virtual void SendDisconnect         (const AString & a_Reason) override;
 	virtual void SendEntHeadLook        (const cEntity & a_Entity) override;
 	virtual void SendEntLook            (const cEntity & a_Entity) override;
+	virtual void SendExperienceOrb      (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ, short a_Amount);
 	virtual void SendEntVelocity        (const cEntity & a_Entity) override;
 	virtual void SendEntRelMove         (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override;
 	virtual void SendEntRelMoveLook     (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override;
Index: World.cpp
===================================================================
--- World.cpp	(revision 1592)
+++ World.cpp	(working copy)
@@ -1459,6 +1459,16 @@
 
 
 
+
+void cWorld::BroadcastExperienceOrb(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ, short a_Amount)
+{
+	m_ChunkMap->BroadcastExperienceOrb(a_Entity, a_BlockX, a_BlockY, a_BlockZ, a_Amount);
+}
+
+
+
+
+
 void cWorld::BroadcastEntLook(const cEntity & a_Entity, const cClientHandle * a_Exclude)
 {
 	m_ChunkMap->BroadcastEntLook(a_Entity, a_Exclude);
Index: World.h
===================================================================
--- World.h	(revision 1592)
+++ World.h	(working copy)
@@ -131,6 +131,7 @@
 	void BroadcastChat               (const AString & a_Message, const cClientHandle * a_Exclude = NULL);
 	void BroadcastPlayerAnimation    (const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude = NULL);
 	void BroadcastEntityEquipment    (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item, const cClientHandle * a_Exclude = NULL);
+	void BroadcastExperienceOrb      (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ, short a_Amount);
 	void BroadcastEntVelocity        (const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
 	void BroadcastTeleportEntity     (const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
 	void BroadcastEntRelMoveLook     (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude = NULL);
