mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-30 06:30:39 -04:00
Added errors in case of wrong MetaData or wrong Chunk Data
This commit is contained in:
parent
5b67cec4e0
commit
529355782e
@ -727,9 +727,17 @@ function readEntityMetadata(buffer, offset) {
|
||||
type = item >> 5;
|
||||
typeName = entityMetadataTypes[type];
|
||||
dataType = types[typeName];
|
||||
assert.ok(dataType, "unrecognized entity metadata type " + type);
|
||||
if (!dataType) {
|
||||
return {
|
||||
error: "unrecognized entity metadata type " + type
|
||||
}
|
||||
}
|
||||
reader = dataType[0];
|
||||
assert.ok(reader, "missing reader for entity metadata type " + type);
|
||||
if (!reader) {
|
||||
return {
|
||||
error: "missing reader for entity metadata type " + type
|
||||
}
|
||||
}
|
||||
results = reader(buffer, cursor);
|
||||
if (! results) return null;
|
||||
metadata.push({
|
||||
@ -808,7 +816,11 @@ function readMapChunkBulk (buffer, offset) {
|
||||
});
|
||||
}
|
||||
|
||||
assert.strictEqual(chunkColumnCount, meta.length);
|
||||
if (chunkColumnCount !== meta.length) {
|
||||
return {
|
||||
error: "ChunkColumnCount different from length of meta"
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
value: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user