diff options
author | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-03-02 14:58:31 +0100 |
---|---|---|
committer | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-03-02 14:58:31 +0100 |
commit | 5179588b6539cf13cb68ef19d5d49d520ed39490 (patch) | |
tree | 2fc32e1e624117dc9b91fdb03f08ab705d71c577 | |
parent | Finally got the multiblock packet working! It seems the byte order was wrong (diff) | |
download | cuberite-5179588b6539cf13cb68ef19d5d49d520ed39490.tar cuberite-5179588b6539cf13cb68ef19d5d49d520ed39490.tar.gz cuberite-5179588b6539cf13cb68ef19d5d49d520ed39490.tar.bz2 cuberite-5179588b6539cf13cb68ef19d5d49d520ed39490.tar.lz cuberite-5179588b6539cf13cb68ef19d5d49d520ed39490.tar.xz cuberite-5179588b6539cf13cb68ef19d5d49d520ed39490.tar.zst cuberite-5179588b6539cf13cb68ef19d5d49d520ed39490.zip |
-rw-r--r-- | source/packets/cPacket_MapChunk.cpp | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/source/packets/cPacket_MapChunk.cpp b/source/packets/cPacket_MapChunk.cpp index e9ebf8355..24d7b8d88 100644 --- a/source/packets/cPacket_MapChunk.cpp +++ b/source/packets/cPacket_MapChunk.cpp @@ -41,18 +41,51 @@ cPacket_MapChunk::cPacket_MapChunk(cChunk * a_Chunk) memset( AllData, 0, DataSize );
unsigned int iterator = 0;
- for( int i = 0; i < 8; ++i ) // Old world is only 8 high
+ for( int i = 0; i < 8; ++i ) // Old world is only 8*16 high (should be 16*16)
{
- m_BitMap1 |= (1 << i);
+ m_BitMap1 |= (1 << i); // This tells what chunks are sent. Use this to NOT send air only chunks (right now everything is sent)
for( int y = 0; y < 16; ++y ) for( int z = 0; z < 16; ++z ) for( int x = 0; x < 16; ++x )
{
AllData[iterator] = a_Chunk->GetBlock( x, y+i*16, z );
++iterator;
}
}
- //TODO: Send block metadata
- //TODO: Send block light
- //TODO: Send sky light
+ //Send block metadata
+ for( int i = 0; i < 8; ++i )
+ {
+ for( int y = 0; y < 16; ++y ) for( int z = 0; z < 16; ++z )
+ {
+ for( int x = 0; x < 8; ++x )
+ {
+ AllData[iterator] = a_Chunk->GetLight( a_Chunk->pGetMeta(), x*2+0, y+i*16, z ) | a_Chunk->GetLight( a_Chunk->pGetMeta(), x*2+1, y+i*16, z ) << 4;
+ ++iterator;
+ }
+ }
+ }
+ //Send block light
+ for( int i = 0; i < 8; ++i )
+ {
+ for( int y = 0; y < 16; ++y ) for( int z = 0; z < 16; ++z )
+ {
+ for( int x = 0; x < 8; ++x )
+ {
+ AllData[iterator] = a_Chunk->GetLight( a_Chunk->pGetLight(), x*2+0, y+i*16, z ) | a_Chunk->GetLight( a_Chunk->pGetLight(), x*2+1, y+i*16, z ) << 4;
+ ++iterator;
+ }
+ }
+ }
+ //Send sky light
+ for( int i = 0; i < 8; ++i )
+ {
+ for( int y = 0; y < 16; ++y ) for( int z = 0; z < 16; ++z )
+ {
+ for( int x = 0; x < 8; ++x )
+ {
+ AllData[iterator] = a_Chunk->GetLight( a_Chunk->pGetSkyLight(), x*2+0, y+i*16, z ) | a_Chunk->GetLight( a_Chunk->pGetSkyLight(), x*2+1, y+i*16, z ) << 4;
+ ++iterator;
+ }
+ }
+ }
uLongf CompressedSize = compressBound( DataSize );
char * CompressedBlockData = new char[CompressedSize];
|