1
0

Fixed mob spawn packet for 1.2 client, now client doesn't bail out when mobs are turned on

git-svn-id: http://mc-server.googlecode.com/svn/trunk@393 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-03-10 19:30:06 +00:00
parent 1a5ebb44aa
commit 732b7349fa
3 changed files with 11 additions and 8 deletions

View File

@ -257,8 +257,9 @@ void cChunk::SetAllData(const char * a_BlockData, cEntityList & a_Entities, cBlo
m_PosX, m_PosZ
);
// Assert because this is a very curious case. These lines were executed once before, when a player died, re spawned, and walked around a bit. It's uncertain why an entity would be in the chunk in this case.
ASSERT(!"Unexpected entity in chunk!");
// MD 2012_03_10: This may happen if a mob is generated near the edge of loaded chunks and walks off of the edge.
// Older: Assert because this is a very curious case. These lines were executed once before, when a player died, re spawned, and walked around a bit. It's uncertain why an entity would be in the chunk in this case.
// ASSERT(!"Unexpected entity in chunk!");
(*itr)->Destroy();
}

View File

@ -26,6 +26,7 @@ cPacket_SpawnMob::cPacket_SpawnMob()
, m_Pitch( 0 )
, m_MetaDataSize( 0 )
, m_MetaData( 0 )
, m_HeadYaw(0)
{
m_PacketID = E_SPAWN_MOB;
}
@ -40,10 +41,11 @@ cPacket_SpawnMob::cPacket_SpawnMob( const cPacket_SpawnMob & a_Clone )
m_PacketID = E_SPAWN_MOB;
m_UniqueID = a_Clone.m_UniqueID;
m_Type = a_Clone.m_Type;
*m_Pos = *a_Clone.m_Pos;
m_Yaw = a_Clone.m_Yaw;
m_Pitch = a_Clone.m_Pitch;
m_Type = a_Clone.m_Type;
*m_Pos = *a_Clone.m_Pos;
m_Yaw = a_Clone.m_Yaw;
m_Pitch = a_Clone.m_Pitch;
m_HeadYaw = a_Clone.m_HeadYaw;
m_MetaDataSize = a_Clone.m_MetaDataSize;
m_MetaData = new char[m_MetaDataSize];
@ -64,6 +66,7 @@ void cPacket_SpawnMob::Serialize(AString & a_Data) const
AppendInteger (a_Data, m_Pos->z);
AppendByte (a_Data, m_Yaw);
AppendByte (a_Data, m_Pitch);
AppendByte (a_Data, m_HeadYaw);
AppendData (a_Data, m_MetaData, m_MetaDataSize);
}

View File

@ -28,8 +28,7 @@ public:
Vector3i* m_Pos;
char m_Yaw;
char m_Pitch;
static const unsigned int c_Size = 1 + 4 + 1 + 4 + 4 + 4 + 1 + 1; // + metadata
char m_HeadYaw;
unsigned int m_MetaDataSize;
char * m_MetaData;