Implented Spawn Experience Orb packet.
This commit is contained in:
parent
2d68969a45
commit
b93d1b5027
@ -86,6 +86,7 @@ public:
|
||||
virtual void SendPlayerSpawn (const cPlayer & a_Player) = 0;
|
||||
virtual void SendRespawn (void) = 0;
|
||||
virtual void SendExperience (void) = 0;
|
||||
virtual void SendExperienceOrb (const cEntity & a_Entity) = 0;
|
||||
virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) = 0; // a_Src coords are Block * 8
|
||||
virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) = 0;
|
||||
virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) = 0;
|
||||
|
@ -17,6 +17,7 @@ Documentation:
|
||||
#include "../World.h"
|
||||
#include "ChunkDataSerializer.h"
|
||||
#include "../Entities/Entity.h"
|
||||
#include "../Entities/ExpOrb.h"
|
||||
#include "../Mobs/Monster.h"
|
||||
#include "../Entities/Pickup.h"
|
||||
#include "../Entities/Player.h"
|
||||
@ -72,6 +73,7 @@ enum
|
||||
PACKET_ENT_STATUS = 0x26,
|
||||
PACKET_ATTACH_ENTITY = 0x27,
|
||||
PACKET_METADATA = 0x28,
|
||||
PACKET_SPAWN_EXPERIENCE_ORB = 0x1A,
|
||||
PACKET_EXPERIENCE = 0x2b,
|
||||
PACKET_PRE_CHUNK = 0x32,
|
||||
PACKET_MAP_CHUNK = 0x33,
|
||||
@ -705,6 +707,22 @@ void cProtocol125::SendExperience(void)
|
||||
|
||||
|
||||
|
||||
void cProtocol125::SendExperienceOrb(const cEntity & a_Entity)
|
||||
{
|
||||
cCSLock Lock(m_CSPacket);
|
||||
WriteByte(PACKET_SPAWN_EXPERIENCE_ORB);
|
||||
WriteInt(a_Entity.GetUniqueID());
|
||||
WriteInt((int) a_Entity.GetPosX());
|
||||
WriteInt((int) a_Entity.GetPosY());
|
||||
WriteInt((int) a_Entity.GetPosZ());
|
||||
WriteShort(((cExpOrb &)a_Entity).GetReward());
|
||||
Flush();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol125::SendSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch)
|
||||
{
|
||||
// Not needed in this protocol version
|
||||
|
@ -63,6 +63,7 @@ public:
|
||||
virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
|
||||
virtual void SendRespawn (void) override;
|
||||
virtual void SendExperience (void) override;
|
||||
virtual void SendExperienceOrb (const cEntity & a_Entity) override;
|
||||
virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) override; // a_Src coords are Block * 8
|
||||
virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
|
||||
virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override;
|
||||
|
@ -17,6 +17,7 @@ Implements the 1.7.x protocol classes:
|
||||
#include "../World.h"
|
||||
#include "../WorldStorage/FastNBT.h"
|
||||
#include "../StringCompression.h"
|
||||
#include "../Entities/ExpOrb.h"
|
||||
#include "../Entities/Minecart.h"
|
||||
#include "../Entities/FallingBlock.h"
|
||||
#include "../Entities/Pickup.h"
|
||||
@ -609,6 +610,20 @@ void cProtocol172::SendExperience (void)
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendExperienceOrb(const cEntity & a_Entity)
|
||||
{
|
||||
cPacketizer Pkt(*this, 0x11);
|
||||
Pkt.WriteVarInt(a_Entity.GetUniqueID());
|
||||
Pkt.WriteInt((int) a_Entity.GetPosX());
|
||||
Pkt.WriteInt((int) a_Entity.GetPosY());
|
||||
Pkt.WriteInt((int) a_Entity.GetPosZ());
|
||||
Pkt.WriteShort(((cExpOrb &)a_Entity).GetReward());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) // a_Src coords are Block * 8
|
||||
{
|
||||
cPacketizer Pkt(*this, 0x29); // Sound Effect packet
|
||||
|
@ -73,6 +73,7 @@ public:
|
||||
virtual void SendRespawn (void) override;
|
||||
virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) override; // a_Src coords are Block * 8
|
||||
virtual void SendExperience (void) override;
|
||||
virtual void SendExperienceOrb (const cEntity & a_Entity) override;
|
||||
virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
|
||||
virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override;
|
||||
virtual void SendSpawnMob (const cMonster & a_Mob) override;
|
||||
|
@ -476,6 +476,16 @@ void cProtocolRecognizer::SendExperience(void)
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendExperienceOrb(const cEntity & a_Entity)
|
||||
{
|
||||
ASSERT(m_Protocol != NULL);
|
||||
m_Protocol->SendExperienceOrb(a_Entity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch)
|
||||
{
|
||||
ASSERT(m_Protocol != NULL);
|
||||
|
@ -98,6 +98,7 @@ public:
|
||||
virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
|
||||
virtual void SendRespawn (void) override;
|
||||
virtual void SendExperience (void) override;
|
||||
virtual void SendExperienceOrb (const cEntity & a_Entity) override;
|
||||
virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) override;
|
||||
virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
|
||||
virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override;
|
||||
|
Loading…
Reference in New Issue
Block a user