Finally got the multiblock packet working! It seems the byte order was wrong

git-svn-id: http://mc-server.googlecode.com/svn/trunk@352 0a769ca7-a7f5-676a-18bf-c427514a06d6
master
faketruth 2012-03-02 13:41:42 +00:00
parent 4dda2a5c2b
commit eceead8394
2 changed files with 5 additions and 6 deletions

View File

@ -358,11 +358,9 @@ void cChunk::Tick(float a_Dt, MTRand & a_TickRandom)
unsigned int X = (index / (128*16)); unsigned int X = (index / (128*16));
#if (MINECRAFT_1_2_2 == 1) #if (MINECRAFT_1_2_2 == 1)
unsigned int Coords = Z | (X << 4) | (Y << 8); unsigned int Coords = Y | Z << 8 | X << 12;
unsigned int Blocks = E_BLOCK_DIRT;//E_BLOCK_STONE; unsigned int Blocks = GetLight( m_BlockMeta, index ) | (m_BlockType[index]<<4);
MultiBlock.m_Data[i].Data = Coords | (E_BLOCK_STONE) << 16; MultiBlock.m_Data[i].Data = Coords << 16 | Blocks;
// MultiBlock.m_Data[i].Coords = E_BLOCK_STONE;//(Z&0xf) | (X&0xf)<<4 | (Y&0xff)<<8;//(Y&0xff) | (Z&0xf) << 8 | (X&0xf) << 12;
#else #else
MultiBlock.m_BlockCoordinates[i] = (Z&0xf) | (X&0xf)<<4 | (Y&0xff)<<8; MultiBlock.m_BlockCoordinates[i] = (Z&0xf) | (X&0xf)<<4 | (Y&0xff)<<8;
//LOG("X: %i Y: %i Z: %i Combo: 0x%04x", X, Y, Z, MultiBlock.m_BlockCoordinates[i] ); //LOG("X: %i Y: %i Z: %i Combo: 0x%04x", X, Y, Z, MultiBlock.m_BlockCoordinates[i] );

View File

@ -57,7 +57,8 @@ void cPacket_MultiBlock::Serialize(AString & a_Data) const
#if (MINECRAFT_1_2_2 == 1) #if (MINECRAFT_1_2_2 == 1)
AppendInteger(a_Data, m_DataSize); AppendInteger(a_Data, m_DataSize);
AppendData (a_Data, (const char*)m_Data, m_DataSize); for( int i = 0; i < m_NumBlocks; ++i )
AppendInteger(a_Data, m_Data[i].Data);
#else #else
AppendData (a_Data, (char *)m_BlockCoordinates, sizeof(short) * m_NumBlocks); AppendData (a_Data, (char *)m_BlockCoordinates, sizeof(short) * m_NumBlocks);
AppendData (a_Data, m_BlockTypes, m_NumBlocks); AppendData (a_Data, m_BlockTypes, m_NumBlocks);