mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-28 13:45:37 -04:00
move rest buffer to minecraft.js
This commit is contained in:
parent
3b7ae54b88
commit
17d0aa1a22
@ -6,7 +6,8 @@ module.exports = {
|
|||||||
'UUID': [readUUID, writeUUID, 16],
|
'UUID': [readUUID, writeUUID, 16],
|
||||||
'position': [readPosition, writePosition, 8],
|
'position': [readPosition, writePosition, 8],
|
||||||
'slot': [readSlot, writeSlot, sizeOfSlot],
|
'slot': [readSlot, writeSlot, sizeOfSlot],
|
||||||
'nbt': [readNbt, utils.buffer[1], utils.buffer[2]]
|
'nbt': [readNbt, utils.buffer[1], utils.buffer[2]],
|
||||||
|
'restBuffer': [readRestBuffer, utils.buffer[1], utils.buffer[2]]
|
||||||
};
|
};
|
||||||
|
|
||||||
function readUUID(buffer, offset) {
|
function readUUID(buffer, offset) {
|
||||||
@ -136,3 +137,10 @@ function sizeOfNbt(value) {
|
|||||||
return nbt.writeUncompressed(value).length;
|
return nbt.writeUncompressed(value).length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function readRestBuffer(buffer, offset, typeArgs, rootNode) {
|
||||||
|
return {
|
||||||
|
value: buffer.slice(offset),
|
||||||
|
size: buffer.length - offset
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -12,7 +12,7 @@ var states = {
|
|||||||
"STATUS": "status",
|
"STATUS": "status",
|
||||||
"LOGIN": "login",
|
"LOGIN": "login",
|
||||||
"PLAY": "play"
|
"PLAY": "play"
|
||||||
}
|
};
|
||||||
|
|
||||||
var packets=require("../protocol/protocol");
|
var packets=require("../protocol/protocol");
|
||||||
|
|
||||||
@ -67,18 +67,18 @@ var types = {
|
|||||||
'bool': utils.bool,
|
'bool': utils.bool,
|
||||||
'string': utils.string,
|
'string': utils.string,
|
||||||
'ustring': utils.ustring,
|
'ustring': utils.ustring,
|
||||||
'UUID': minecraft.UUID,
|
|
||||||
'container': [readContainer, writeContainer, sizeOfContainer],
|
'container': [readContainer, writeContainer, sizeOfContainer],
|
||||||
'array': [readArray, writeArray, sizeOfArray],
|
'array': [readArray, writeArray, sizeOfArray],
|
||||||
'buffer': utils.buffer,
|
'buffer': utils.buffer,
|
||||||
'restBuffer': [readRestBuffer, utils.buffer[1], utils.buffer[2]],
|
|
||||||
'count': [readCount, writeCount, sizeOfCount],
|
'count': [readCount, writeCount, sizeOfCount],
|
||||||
|
'condition': [readCondition, writeCondition, sizeOfCondition],
|
||||||
// TODO : remove type-specific, replace with generic containers and arrays.
|
// TODO : remove type-specific, replace with generic containers and arrays.
|
||||||
|
'restBuffer': minecraft.restBuffer,
|
||||||
|
'UUID': minecraft.UUID,
|
||||||
'position': minecraft.position,
|
'position': minecraft.position,
|
||||||
'slot': minecraft.slot,
|
'slot': minecraft.slot,
|
||||||
'nbt': minecraft.nbt,
|
'nbt': minecraft.nbt,
|
||||||
'entityMetadata': [readEntityMetadata, writeEntityMetadata, sizeOfEntityMetadata],
|
'entityMetadata': [readEntityMetadata, writeEntityMetadata, sizeOfEntityMetadata]
|
||||||
'condition': [readCondition, writeCondition, sizeOfCondition]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var debug;
|
var debug;
|
||||||
@ -265,13 +265,6 @@ function sizeOfContainer(value, typeArgs, rootNode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function readRestBuffer(buffer, offset, typeArgs, rootNode) {
|
|
||||||
return {
|
|
||||||
value: buffer.slice(offset),
|
|
||||||
size: buffer.length - offset
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// begin array
|
// begin array
|
||||||
function evalCount(count,fields)
|
function evalCount(count,fields)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user