mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2025-05-09 12:50:26 -04:00
0x38: remove chunkColumnCount. Use meta.length
This commit is contained in:
parent
ab54392f46
commit
a50bf7926b
1 changed files with 5 additions and 4 deletions
|
@ -623,11 +623,11 @@ function readObjectData(buffer, offset) {
|
|||
function readMapChunkBulk (buffer, offset) {
|
||||
var cursor = offset + 7;
|
||||
if (cursor > buffer.length) return null;
|
||||
var chunkCount = buffer.readInt16BE(offset);
|
||||
var chunkColumnCount = buffer.readInt16BE(offset);
|
||||
var dataSize = buffer.readInt32BE(offset + 2);
|
||||
var skyLightSent = !!buffer.readInt8(offset + 6);
|
||||
|
||||
var cursorEnd = cursor + dataSize + 12 * chunkCount;
|
||||
var cursorEnd = cursor + dataSize + 12 * chunkColumnCount;
|
||||
if (cursorEnd > buffer.length) return null;
|
||||
|
||||
var compressedChunkDataEnd = cursor + dataSize;
|
||||
|
@ -636,7 +636,7 @@ function readMapChunkBulk (buffer, offset) {
|
|||
|
||||
var meta = [];
|
||||
var i, chunkX, chunkZ, bitMap, addBitMap;
|
||||
for (i = 0; i < chunkCount; ++i) {
|
||||
for (i = 0; i < chunkColumnCount; ++i) {
|
||||
chunkX = buffer.readInt32BE(cursor);
|
||||
cursor += 4;
|
||||
chunkZ = buffer.readInt32BE(cursor);
|
||||
|
@ -654,10 +654,11 @@ function readMapChunkBulk (buffer, offset) {
|
|||
});
|
||||
}
|
||||
|
||||
assert.strictEqual(chunkColumnCount, meta.length);
|
||||
|
||||
return {
|
||||
value: {
|
||||
skyLightSent: skyLightSent,
|
||||
chunkCount: chunkCount,
|
||||
compressedChunkData: compressedChunkData,
|
||||
meta: meta,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue