mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-29 06:03:33 -04:00
more packets supported
This commit is contained in:
parent
4619530247
commit
f1da7b152b
@ -62,6 +62,7 @@ Parser.prototype.writePacket = function(packetId, params) {
|
|||||||
var writers = {
|
var writers = {
|
||||||
'int': IntWriter,
|
'int': IntWriter,
|
||||||
'byte': ByteWriter,
|
'byte': ByteWriter,
|
||||||
|
'ubyte': UByteWriter,
|
||||||
'string': StringWriter,
|
'string': StringWriter,
|
||||||
'byteArray': ByteArrayWriter,
|
'byteArray': ByteArrayWriter,
|
||||||
};
|
};
|
||||||
@ -72,6 +73,7 @@ var readers = {
|
|||||||
'short': readShort,
|
'short': readShort,
|
||||||
'int': readInt,
|
'int': readInt,
|
||||||
'byte': readByte,
|
'byte': readByte,
|
||||||
|
'ubyte': readUByte,
|
||||||
'long': readLong,
|
'long': readLong,
|
||||||
'slot': readSlot,
|
'slot': readSlot,
|
||||||
'bool': readBool,
|
'bool': readBool,
|
||||||
@ -333,6 +335,15 @@ function readByte(buffer, offset) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function readUByte(buffer, offset) {
|
||||||
|
if (offset + 1 > buffer.length) return null;
|
||||||
|
var value = buffer.readUInt8(offset);
|
||||||
|
return {
|
||||||
|
value: value,
|
||||||
|
size: 1,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function readBool(buffer, offset) {
|
function readBool(buffer, offset) {
|
||||||
if (offset + 1 > buffer.length) return null;
|
if (offset + 1 > buffer.length) return null;
|
||||||
var value = buffer.readInt8(offset);
|
var value = buffer.readInt8(offset);
|
||||||
|
200
packets.json
200
packets.json
@ -97,6 +97,98 @@
|
|||||||
"type": "int"
|
"type": "int"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"7": [
|
||||||
|
{
|
||||||
|
"name": "user",
|
||||||
|
"type": "int"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "target",
|
||||||
|
"type": "int"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mouseButton",
|
||||||
|
"type": "bool"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"8": [
|
||||||
|
{
|
||||||
|
"name": "health",
|
||||||
|
"type": "short"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "food",
|
||||||
|
"type": "short"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "foodSaturation",
|
||||||
|
"type": "float"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"9": [
|
||||||
|
{
|
||||||
|
"name": "dimension",
|
||||||
|
"type": "int"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "difficulty",
|
||||||
|
"type": "byte"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "gameMode",
|
||||||
|
"type": "byte"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "worldHeight",
|
||||||
|
"type": "short"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "levelType",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10": [
|
||||||
|
{
|
||||||
|
"name": "onGround",
|
||||||
|
"type": "bool"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"11": [
|
||||||
|
{
|
||||||
|
"name": "x",
|
||||||
|
"type": "double"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "y",
|
||||||
|
"type": "double"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stance",
|
||||||
|
"type": "double"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "z",
|
||||||
|
"type": "double"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "onGround",
|
||||||
|
"type": "bool"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"12": [
|
||||||
|
{
|
||||||
|
"name": "yaw",
|
||||||
|
"type": "float"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "pitch",
|
||||||
|
"type": "float"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "onGround",
|
||||||
|
"type": "bool"
|
||||||
|
}
|
||||||
|
],
|
||||||
"13": [
|
"13": [
|
||||||
{
|
{
|
||||||
"name": "x",
|
"name": "x",
|
||||||
@ -127,12 +219,110 @@
|
|||||||
"type": "bool"
|
"type": "bool"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"14": [
|
||||||
|
{
|
||||||
|
"name": "status",
|
||||||
|
"type": "byte"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x",
|
||||||
|
"type": "int"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "y",
|
||||||
|
"type": "byte"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "z",
|
||||||
|
"type": "int"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "face",
|
||||||
|
"type": "byte"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"15": [
|
||||||
|
{
|
||||||
|
"name": "x",
|
||||||
|
"type": "int"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "y",
|
||||||
|
"type": "ubyte"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "z",
|
||||||
|
"type": "int"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "direction",
|
||||||
|
"type": "byte"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "heldItem",
|
||||||
|
"type": "slot"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "cursorX",
|
||||||
|
"type": "byte"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "cursorY",
|
||||||
|
"type": "byte"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "cursorZ",
|
||||||
|
"type": "byte"
|
||||||
|
}
|
||||||
|
],
|
||||||
"16": [
|
"16": [
|
||||||
{
|
{
|
||||||
"name": "slotId",
|
"name": "slotId",
|
||||||
"type": "short"
|
"type": "short"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"17": [
|
||||||
|
{
|
||||||
|
"name": "entityId",
|
||||||
|
"type": "int"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "_unknown",
|
||||||
|
"type": "byte"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x",
|
||||||
|
"type": "int"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "y",
|
||||||
|
"type": "byte"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "z",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"18": [
|
||||||
|
{
|
||||||
|
"name": "entityId",
|
||||||
|
"type": "int"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "animation",
|
||||||
|
"type": "byte"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"19": [
|
||||||
|
{
|
||||||
|
"name": "entityId",
|
||||||
|
"type": "int"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "actionId",
|
||||||
|
"type": "byte"
|
||||||
|
}
|
||||||
|
],
|
||||||
"20": [
|
"20": [
|
||||||
{
|
{
|
||||||
"name": "entityId",
|
"name": "entityId",
|
||||||
@ -171,6 +361,16 @@
|
|||||||
"type": "entityMetadata"
|
"type": "entityMetadata"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"22": [
|
||||||
|
{
|
||||||
|
"name": "collectedEntityId",
|
||||||
|
"type": "int"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "collectorEntityId",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
],
|
||||||
"23": [
|
"23": [
|
||||||
{
|
{
|
||||||
"name": "entityId",
|
"name": "entityId",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user