1
0

Monster classes don't use cPackets. Chat messages are sent / broadcast without cPackets. BlockEntities don't use cPackets.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@783 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com
2012-08-24 07:58:26 +00:00
parent 263ce31bd6
commit e92b9e7ecb
39 changed files with 562 additions and 426 deletions

View File

@@ -58,25 +58,10 @@ public:
virtual void UsedBy( cPlayer * a_Player ) = 0;
void SendTo( cClientHandle* a_Client )
{
std::auto_ptr<cPacket> Packet(GetPacket());
if (Packet.get() == NULL)
{
return;
}
if ( a_Client != NULL )
{
a_Client->Send(*(Packet.get()));
}
else // broadcast to all chunk clients
{
m_World->BroadcastToChunkOfBlock(m_PosX, m_PosY, m_PosZ, Packet.get());
}
}
/// Returns the packet to send to clients to represent this entity; NULL if no packet needed; caller is supposed to delete the packet
virtual cPacket * GetPacket(void) {return NULL; }
/** Sends the packet defining the block entity to the client specified.
To send to all eligible clients, use cWorld::BroadcastBlockEntity()
*/
virtual void SendTo(cClientHandle & a_Client) = 0;
protected:
int m_PosX; // Position in absolute block coordinates