mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-28 05:35:56 -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],
|
||||
'position': [readPosition, writePosition, 8],
|
||||
'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) {
|
||||
@ -136,3 +137,10 @@ function sizeOfNbt(value) {
|
||||
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",
|
||||
"LOGIN": "login",
|
||||
"PLAY": "play"
|
||||
}
|
||||
};
|
||||
|
||||
var packets=require("../protocol/protocol");
|
||||
|
||||
@ -67,18 +67,18 @@ var types = {
|
||||
'bool': utils.bool,
|
||||
'string': utils.string,
|
||||
'ustring': utils.ustring,
|
||||
'UUID': minecraft.UUID,
|
||||
'container': [readContainer, writeContainer, sizeOfContainer],
|
||||
'array': [readArray, writeArray, sizeOfArray],
|
||||
'buffer': utils.buffer,
|
||||
'restBuffer': [readRestBuffer, utils.buffer[1], utils.buffer[2]],
|
||||
'count': [readCount, writeCount, sizeOfCount],
|
||||
'condition': [readCondition, writeCondition, sizeOfCondition],
|
||||
// TODO : remove type-specific, replace with generic containers and arrays.
|
||||
'restBuffer': minecraft.restBuffer,
|
||||
'UUID': minecraft.UUID,
|
||||
'position': minecraft.position,
|
||||
'slot': minecraft.slot,
|
||||
'nbt': minecraft.nbt,
|
||||
'entityMetadata': [readEntityMetadata, writeEntityMetadata, sizeOfEntityMetadata],
|
||||
'condition': [readCondition, writeCondition, sizeOfCondition]
|
||||
'entityMetadata': [readEntityMetadata, writeEntityMetadata, sizeOfEntityMetadata]
|
||||
};
|
||||
|
||||
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
|
||||
function evalCount(count,fields)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user