mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-12-02 03:56:54 -05:00
Start on updating protocol to 1.8
This commit is contained in:
parent
ba4d871984
commit
29a93f319e
1 changed files with 157 additions and 130 deletions
257
lib/protocol.js
257
lib/protocol.js
|
@ -76,7 +76,7 @@ var packets = {
|
||||||
play: {
|
play: {
|
||||||
toClient: {
|
toClient: {
|
||||||
keep_alive: {id: 0x00, fields: [
|
keep_alive: {id: 0x00, fields: [
|
||||||
{ name: "keepAliveId", type: "int" },
|
{ name: "keepAliveId", type: "int" /* TODO: Int or VarInt */ },
|
||||||
]},
|
]},
|
||||||
login: {id: 0x01, fields: [
|
login: {id: 0x01, fields: [
|
||||||
{ name: "entityId", type: "int" },
|
{ name: "entityId", type: "int" },
|
||||||
|
@ -85,27 +85,27 @@ var packets = {
|
||||||
{ name: "difficulty", type: "ubyte" },
|
{ name: "difficulty", type: "ubyte" },
|
||||||
{ name: "maxPlayers", type: "ubyte" },
|
{ name: "maxPlayers", type: "ubyte" },
|
||||||
{ name: "levelType", type: "string" },
|
{ name: "levelType", type: "string" },
|
||||||
|
{ name: "reducedDebugInfo", type: "bool"}
|
||||||
]},
|
]},
|
||||||
chat: {id: 0x02, fields: [
|
chat: {id: 0x02, fields: [
|
||||||
{ name: "message", type: "ustring" },
|
{ name: "message", type: "ustring" },
|
||||||
|
{ name: "position", type: "byte" }
|
||||||
]},
|
]},
|
||||||
update_time: {id: 0x03, fields: [
|
update_time: {id: 0x03, fields: [
|
||||||
{ name: "age", type: "long" },
|
{ name: "age", type: "long" },
|
||||||
{ name: "time", type: "long" },
|
{ name: "time", type: "long" },
|
||||||
]},
|
]},
|
||||||
entity_equipment: {id: 0x04, fields: [
|
entity_equipment: {id: 0x04, fields: [
|
||||||
{ name: "entityId", type: "int" },
|
{ name: "entityId", type: "int" /* TODO: Int or VarInt */ },
|
||||||
{ name: "slot", type: "short" },
|
{ name: "slot", type: "short" },
|
||||||
{ name: "item", type: "slot" }
|
{ name: "item", type: "slot" }
|
||||||
]},
|
]},
|
||||||
spawn_position: {id: 0x05, fields: [
|
spawn_position: {id: 0x05, fields: [
|
||||||
{ name: "x", type: "int" },
|
{ name: "location", type: "position" } /* TODO: Implement position */
|
||||||
{ name: "y", type: "int" },
|
|
||||||
{ name: "z", type: "int" }
|
|
||||||
]},
|
]},
|
||||||
update_health: {id: 0x06, fields: [
|
update_health: {id: 0x06, fields: [
|
||||||
{ name: "health", type: "float" },
|
{ name: "health", type: "float" },
|
||||||
{ name: "food", type: "short" },
|
{ name: "food", type: "varint" },
|
||||||
{ name: "foodSaturation", type: "float" }
|
{ name: "foodSaturation", type: "float" }
|
||||||
]},
|
]},
|
||||||
respawn: {id: 0x07, fields: [
|
respawn: {id: 0x07, fields: [
|
||||||
|
@ -120,16 +120,14 @@ var packets = {
|
||||||
{ name: "z", type: "double" },
|
{ name: "z", type: "double" },
|
||||||
{ name: "yaw", type: "float" },
|
{ name: "yaw", type: "float" },
|
||||||
{ name: "pitch", type: "float" },
|
{ name: "pitch", type: "float" },
|
||||||
{ name: "onGround", type: "bool" }
|
{ name: "flags", type: "byte" /* <Dinnerbone> It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute. */}
|
||||||
]},
|
]},
|
||||||
held_item_slot: {id: 0x09, fields: [
|
held_item_slot: {id: 0x09, fields: [
|
||||||
{ name: "slot", type: "byte" }
|
{ name: "slot", type: "byte" }
|
||||||
]},
|
]},
|
||||||
bed: {id: 0x0a, fields: [
|
bed: {id: 0x0a, fields: [
|
||||||
{ name: "entityId", type: "int" },
|
{ name: "entityId", type: "int" },
|
||||||
{ name: "x", type: "int" },
|
{ name: "position", type: "location" }
|
||||||
{ name: "y", type: "ubyte" },
|
|
||||||
{ name: "z", type: "int" }
|
|
||||||
]},
|
]},
|
||||||
animation: {id: 0x0b, fields: [
|
animation: {id: 0x0b, fields: [
|
||||||
{ name: "entityId", type: "varint" },
|
{ name: "entityId", type: "varint" },
|
||||||
|
@ -137,15 +135,7 @@ var packets = {
|
||||||
]},
|
]},
|
||||||
named_entity_spawn: {id: 0x0c, fields: [
|
named_entity_spawn: {id: 0x0c, fields: [
|
||||||
{ name: "entityId", type: "varint" },
|
{ name: "entityId", type: "varint" },
|
||||||
{ name: "playerUUID", type: "string" },
|
{ name: "playerUUID", type: "UUID"},
|
||||||
{ name: "playerName", type: "string" },
|
|
||||||
{ name: "dataCount", type: "count", typeArgs: { type: "varint", countFor: "data" }},
|
|
||||||
{ name: "data", type: "array", typeArgs: { count: "dataCount",
|
|
||||||
type: "container", typeArgs: { fields: [
|
|
||||||
{ name: "name", type: "string" },
|
|
||||||
{ name: "value", type: "string" },
|
|
||||||
{ name: "signature", type: "string" }
|
|
||||||
]}}},
|
|
||||||
{ name: "x", type: "int" },
|
{ name: "x", type: "int" },
|
||||||
{ name: "y", type: "int" },
|
{ name: "y", type: "int" },
|
||||||
{ name: "z", type: "int" },
|
{ name: "z", type: "int" },
|
||||||
|
@ -155,8 +145,8 @@ var packets = {
|
||||||
{ name: "metadata", type: "entityMetadata" }
|
{ name: "metadata", type: "entityMetadata" }
|
||||||
]},
|
]},
|
||||||
collect: {id: 0x0d, fields: [
|
collect: {id: 0x0d, fields: [
|
||||||
{ name: "collectedEntityId", type: "int" },
|
{ name: "collectedEntityId", type: "int" /* TODO: Int or VarInt */},
|
||||||
{ name: "collectorEntityId", type: "int" }
|
{ name: "collectorEntityId", type: "int" /* TODO: Int or VarInt */}
|
||||||
]},
|
]},
|
||||||
spawn_entity: {id: 0x0e, fields: [
|
spawn_entity: {id: 0x0e, fields: [
|
||||||
{ name: "entityId", type: "varint" },
|
{ name: "entityId", type: "varint" },
|
||||||
|
@ -185,9 +175,9 @@ var packets = {
|
||||||
{ name: "x", type: "int" },
|
{ name: "x", type: "int" },
|
||||||
{ name: "y", type: "int" },
|
{ name: "y", type: "int" },
|
||||||
{ name: "z", type: "int" },
|
{ name: "z", type: "int" },
|
||||||
|
{ name: "yaw", type: "byte" },
|
||||||
{ name: "pitch", type: "byte" },
|
{ name: "pitch", type: "byte" },
|
||||||
{ name: "headPitch", type: "byte" },
|
{ name: "headPitch", type: "byte" },
|
||||||
{ name: "yaw", type: "byte" },
|
|
||||||
{ name: "velocityX", type: "short" },
|
{ name: "velocityX", type: "short" },
|
||||||
{ name: "velocityY", type: "short" },
|
{ name: "velocityY", type: "short" },
|
||||||
{ name: "velocityZ", type: "short" },
|
{ name: "velocityZ", type: "short" },
|
||||||
|
@ -196,10 +186,8 @@ var packets = {
|
||||||
spawn_entity_painting: {id: 0x10, fields: [
|
spawn_entity_painting: {id: 0x10, fields: [
|
||||||
{ name: "entityId", type: "varint" },
|
{ name: "entityId", type: "varint" },
|
||||||
{ name: "title", type: "string" },
|
{ name: "title", type: "string" },
|
||||||
{ name: "x", type: "int" },
|
{ name: "location", type: "position" },
|
||||||
{ name: "y", type: "int" },
|
{ name: "direction", type: "ubyte" }
|
||||||
{ name: "z", type: "int" },
|
|
||||||
{ name: "direction", type: "int" }
|
|
||||||
]},
|
]},
|
||||||
spawn_entity_experience_orb: {id: 0x11, fields: [
|
spawn_entity_experience_orb: {id: 0x11, fields: [
|
||||||
{ name: "entityId", type: "varint" },
|
{ name: "entityId", type: "varint" },
|
||||||
|
@ -215,41 +203,45 @@ var packets = {
|
||||||
{ name: "velocityZ", type: "short" }
|
{ name: "velocityZ", type: "short" }
|
||||||
]},
|
]},
|
||||||
entity_destroy: {id: 0x13, fields: [
|
entity_destroy: {id: 0x13, fields: [
|
||||||
{ name: "count", type: "count", typeArgs: { type: "byte", countFor: "entityIds" } },
|
{ name: "count", type: "count", typeArgs: { type: "byte", countFor: "entityIds" } }, /* TODO: Might not be correct */
|
||||||
{ name: "entityIds", type: "array", typeArgs: { type: "int", count: "count" } }
|
{ name: "entityIds", type: "array", typeArgs: { type: "int", count: "count" } }
|
||||||
]},
|
]},
|
||||||
entity: {id: 0x14, fields: [
|
entity: {id: 0x14, fields: [
|
||||||
{ name: "entityId", type: "int" }
|
{ name: "entityId", type: "int" }
|
||||||
]},
|
]},
|
||||||
rel_entity_move: {id: 0x15, fields: [
|
rel_entity_move: {id: 0x15, fields: [
|
||||||
{ name: "entityId", type: "int" },
|
{ name: "entityId", type: "int" }, /* TODO: Int or VarInt */
|
||||||
{ name: "dX", type: "byte" },
|
{ name: "dX", type: "byte" },
|
||||||
{ name: "dY", type: "byte" },
|
{ name: "dY", type: "byte" },
|
||||||
{ name: "dZ", type: "byte" }
|
{ name: "dZ", type: "byte" },
|
||||||
|
{ name: "onGround", type: "bool"}
|
||||||
]},
|
]},
|
||||||
entity_look: {id: 0x16, fields: [
|
entity_look: {id: 0x16, fields: [
|
||||||
{ name: "entityId", type: "int" },
|
{ name: "entityId", type: "int" }, /* TODO: Int or VarInt */
|
||||||
{ name: "yaw", type: "byte" },
|
{ name: "yaw", type: "byte" },
|
||||||
{ name: "pitch", type: "byte" }
|
{ name: "pitch", type: "byte" },
|
||||||
|
{ name: "onGround", type: "bool"}
|
||||||
]},
|
]},
|
||||||
entity_move_look: {id: 0x17, fields: [
|
entity_move_look: {id: 0x17, fields: [
|
||||||
{ name: "entityId", type: "int" },
|
{ name: "entityId", type: "int" }, /* TODO: Int or VarInt */
|
||||||
{ name: "dX", type: "byte" },
|
{ name: "dX", type: "byte" },
|
||||||
{ name: "dY", type: "byte" },
|
{ name: "dY", type: "byte" },
|
||||||
{ name: "dZ", type: "byte" },
|
{ name: "dZ", type: "byte" },
|
||||||
{ name: "yaw", type: "byte" },
|
{ name: "yaw", type: "byte" },
|
||||||
{ name: "pitch", type: "byte" }
|
{ name: "pitch", type: "byte" },
|
||||||
|
{ name: "onGround", type: "bool"}
|
||||||
]},
|
]},
|
||||||
entity_teleport: {id: 0x18, fields: [
|
entity_teleport: {id: 0x18, fields: [
|
||||||
{ name: "entityId", type: "int" },
|
{ name: "entityId", type: "int" }, /* TODO: Int or VarInt */
|
||||||
{ name: "x", type: "int" },
|
{ name: "x", type: "int" },
|
||||||
{ name: "y", type: "int" },
|
{ name: "y", type: "int" },
|
||||||
{ name: "z", type: "int" },
|
{ name: "z", type: "int" },
|
||||||
{ name: "yaw", type: "byte" },
|
{ name: "yaw", type: "byte" },
|
||||||
{ name: "pitch", type: "byte" }
|
{ name: "pitch", type: "byte" },
|
||||||
|
{ name: "onGround", type: "bool"}
|
||||||
]},
|
]},
|
||||||
entity_head_rotation: {id: 0x19, fields: [
|
entity_head_rotation: {id: 0x19, fields: [
|
||||||
{ name: "entityId", type: "int" },
|
{ name: "entityId", type: "int" }, /* TODO: Int or VarInt */
|
||||||
{ name: "headYaw", type: "byte" },
|
{ name: "headYaw", type: "byte" },
|
||||||
]},
|
]},
|
||||||
entity_status: {id: 0x1a, fields: [
|
entity_status: {id: 0x1a, fields: [
|
||||||
|
@ -262,26 +254,27 @@ var packets = {
|
||||||
{ name: "leash", type: "bool" }
|
{ name: "leash", type: "bool" }
|
||||||
]},
|
]},
|
||||||
entity_metadata: {id: 0x1c, fields: [
|
entity_metadata: {id: 0x1c, fields: [
|
||||||
{ name: "entityId", type: "int" },
|
{ name: "entityId", type: "int" }, /* TODO: Int or VarInt */
|
||||||
{ name: "metadata", type: "entityMetadata" }
|
{ name: "metadata", type: "entityMetadata" }
|
||||||
]},
|
]},
|
||||||
entity_effect: {id: 0x1d, fields: [
|
entity_effect: {id: 0x1d, fields: [
|
||||||
{ name: "entityId", type: "int" },
|
{ name: "entityId", type: "int" }, /* TODO: Int or VarInt */
|
||||||
{ name: "effectId", type: "byte" },
|
{ name: "effectId", type: "byte" },
|
||||||
{ name: "amplifier", type: "byte" },
|
{ name: "amplifier", type: "byte" },
|
||||||
{ name: "duration", type: "short" }
|
{ name: "duration", type: "varint" },
|
||||||
|
{ name: "hideParticles", type: "bool" }
|
||||||
]},
|
]},
|
||||||
remove_entity_effect: {id: 0x1e, fields: [
|
remove_entity_effect: {id: 0x1e, fields: [
|
||||||
{ name: "entityId", type: "int" },
|
{ name: "entityId", type: "int" }, /* TODO: Int or VarInt */
|
||||||
{ name: "effectId", type: "byte" }
|
{ name: "effectId", type: "byte" }
|
||||||
]},
|
]},
|
||||||
experience: {id: 0x1f, fields: [
|
experience: {id: 0x1f, fields: [
|
||||||
{ name: "experienceBar", type: "float" },
|
{ name: "experienceBar", type: "float" },
|
||||||
{ name: "level", type: "short" },
|
{ name: "level", type: "varint" },
|
||||||
{ name: "totalExperience", type: "short" }
|
{ name: "totalExperience", type: "varint" }
|
||||||
]},
|
]},
|
||||||
update_attributes: {id: 0x20, fields: [
|
update_attributes: {id: 0x20, fields: [
|
||||||
{ name: "entityId", type: "int" },
|
{ name: "entityId", type: "int" }, /* TODO: Int or VarInt */
|
||||||
{ name: "count", type: "count", typeArgs: { type: "int", countFor: "properties" } },
|
{ name: "count", type: "count", typeArgs: { type: "int", countFor: "properties" } },
|
||||||
{ name: "properties", type: "array", typeArgs: { count: "count",
|
{ name: "properties", type: "array", typeArgs: { count: "count",
|
||||||
type: "container", typeArgs: { fields: [
|
type: "container", typeArgs: { fields: [
|
||||||
|
@ -302,44 +295,37 @@ var packets = {
|
||||||
{ name: "z", type: "int" },
|
{ name: "z", type: "int" },
|
||||||
{ name: "groundUp", type: "bool" },
|
{ name: "groundUp", type: "bool" },
|
||||||
{ name: "bitMap", type: "ushort" },
|
{ name: "bitMap", type: "ushort" },
|
||||||
{ name: "addBitMap", type: "ushort" },
|
{ name: "chunkDataLength", type: "count", typeArgs: { type: "int", countFor: "compressedChunkData" } }, /* TODO: Int or VarInt */
|
||||||
{ name: "compressedChunkDataLength", type: "count", typeArgs: { type: "int", countFor: "compressedChunkData" } },
|
{ name: "chunkData", type: "buffer", typeArgs: { count: "compressedChunkDataLength" } },
|
||||||
{ name: "compressedChunkData", type: "buffer", typeArgs: { count: "compressedChunkDataLength" } },
|
|
||||||
]},
|
]},
|
||||||
multi_block_change: {id: 0x22, fields: [
|
multi_block_change: {id: 0x22, fields: [
|
||||||
{ name: "chunkX", type: "int" },
|
{ name: "chunkX", type: "int" },
|
||||||
{ name: "chunkZ", type: "int" },
|
{ name: "chunkZ", type: "int" },
|
||||||
{ name: "recordCount", type: "short" },
|
{ name: "recordCount", type: "varint" },
|
||||||
|
/* TODO: Is dataLength needed? */
|
||||||
{ name: "dataLength", type: "count", typeArgs: { type: "int", countFor: "data" } },
|
{ name: "dataLength", type: "count", typeArgs: { type: "int", countFor: "data" } },
|
||||||
{ name: "data", type: "buffer", typeArgs: { count: "dataLength" } },
|
{ name: "data", type: "buffer", typeArgs: { count: "dataLength" } },
|
||||||
]},
|
]},
|
||||||
block_change: {id: 0x23, fields: [
|
block_change: {id: 0x23, fields: [
|
||||||
{ name: "x", type: "int" },
|
{ name: "location", type: "position" },
|
||||||
{ name: "y", type: "ubyte" },
|
|
||||||
{ name: "z", type: "int" },
|
|
||||||
{ name: "type", type: "varint" },
|
{ name: "type", type: "varint" },
|
||||||
{ name: "metadata", type: "ubyte" }
|
|
||||||
]},
|
]},
|
||||||
block_action: {id: 0x24, fields: [
|
block_action: {id: 0x24, fields: [
|
||||||
{ name: "x", type: "int" },
|
{ name: "location", type: "position" },
|
||||||
{ name: "y", type: "short" },
|
|
||||||
{ name: "z", type: "int" },
|
|
||||||
{ name: "byte1", type: "ubyte" },
|
{ name: "byte1", type: "ubyte" },
|
||||||
{ name: "byte2", type: "ubyte" },
|
{ name: "byte2", type: "ubyte" },
|
||||||
{ name: "blockId", type: "varint" }
|
{ name: "blockId", type: "varint" }
|
||||||
]},
|
]},
|
||||||
block_break_animation: {id: 0x25, fields: [
|
block_break_animation: {id: 0x25, fields: [
|
||||||
{ name: "entityId", type: "varint" },
|
{ name: "entityId", type: "varint" },
|
||||||
{ name: "x", type: "int" },
|
{ name: "location", type: "position" },
|
||||||
{ name: "y", type: "int" },
|
|
||||||
{ name: "z", type: "int" },
|
|
||||||
{ name: "destroyStage", type: "byte" }
|
{ name: "destroyStage", type: "byte" }
|
||||||
]},
|
]},
|
||||||
map_chunk_bulk: {id: 0x26, fields: [
|
map_chunk_bulk: {id: 0x26, fields: [ /* TODO: This is probably wrong */
|
||||||
{ name: "chunkColumnCount", type: "count", typeArgs: { type: "short", countFor: "meta" } },
|
|
||||||
{ name: "dataLength", type: "count", typeArgs: { type: "int", countFor: "compressedChunkData" } },
|
|
||||||
{ name: "skyLightSent", type: "bool" },
|
{ name: "skyLightSent", type: "bool" },
|
||||||
{ name: "compressedChunkData", type: "buffer", typeArgs: { count: "dataLength" } },
|
{ name: "chunkColumnCount", type: "count", typeArgs: { type: "varint", countFor: "meta" } },
|
||||||
|
{ name: "dataLength", type: "count", typeArgs: { type: "int", countFor: "chunkData" } },
|
||||||
|
{ name: "chunkData", type: "buffer", typeArgs: { count: "dataLength" } },
|
||||||
{ name: "meta", type: "array", typeArgs: { count: "chunkColumnCount",
|
{ name: "meta", type: "array", typeArgs: { count: "chunkColumnCount",
|
||||||
type: "container", typeArgs: { fields: [
|
type: "container", typeArgs: { fields: [
|
||||||
{ name: "x", type: "int" },
|
{ name: "x", type: "int" },
|
||||||
|
@ -367,9 +353,7 @@ var packets = {
|
||||||
]},
|
]},
|
||||||
world_event: {id: 0x28, fields: [ // TODO : kinda wtf naming there
|
world_event: {id: 0x28, fields: [ // TODO : kinda wtf naming there
|
||||||
{ name: "effectId", type: "int" },
|
{ name: "effectId", type: "int" },
|
||||||
{ name: "x", type: "int" },
|
{ name: "location", type: "position" },
|
||||||
{ name: "y", type: "byte" },
|
|
||||||
{ name: "z", type: "int" },
|
|
||||||
{ name: "data", type: "int" },
|
{ name: "data", type: "int" },
|
||||||
{ name: "global", type: "bool" }
|
{ name: "global", type: "bool" }
|
||||||
]},
|
]},
|
||||||
|
@ -382,15 +366,17 @@ var packets = {
|
||||||
{ name: "pitch", type: "ubyte" }
|
{ name: "pitch", type: "ubyte" }
|
||||||
]},
|
]},
|
||||||
world_particles: {id: 0x2a, fields: [
|
world_particles: {id: 0x2a, fields: [
|
||||||
{ name: "particleName", type: "string" },
|
{ name: "particleId", type: "int" },
|
||||||
|
{ name: "longDistance", type: "bool"},
|
||||||
{ name: "x", type: "float" },
|
{ name: "x", type: "float" },
|
||||||
{ name: "y", type: "float" },
|
{ name: "y", type: "float" },
|
||||||
{ name: "z", type: "float" },
|
{ name: "z", type: "float" },
|
||||||
{ name: "offsetX", type: "float" },
|
{ name: "offsetX", type: "float" },
|
||||||
{ name: "offsetY", type: "float" },
|
{ name: "offsetY", type: "float" },
|
||||||
{ name: "offsetZ", type: "float" },
|
{ name: "offsetZ", type: "float" },
|
||||||
{ name: "particleSpeed", type: "float" },
|
{ name: "particleData", type: "float" },
|
||||||
{ name: "particles", type: "int" }
|
{ name: "particles", type: "int" }
|
||||||
|
/* TODO: Create an Array of VarInts */
|
||||||
]},
|
]},
|
||||||
game_state_change: {id: 0x2b, fields: [
|
game_state_change: {id: 0x2b, fields: [
|
||||||
{ name: "reason", type: "ubyte" },
|
{ name: "reason", type: "ubyte" },
|
||||||
|
@ -405,10 +391,9 @@ var packets = {
|
||||||
]},
|
]},
|
||||||
open_window: {id: 0x2d, fields: [
|
open_window: {id: 0x2d, fields: [
|
||||||
{ name: "windowId", type: "ubyte" },
|
{ name: "windowId", type: "ubyte" },
|
||||||
{ name: "inventoryType", type: "ubyte" },
|
{ name: "inventoryType", type: "string" },
|
||||||
{ name: "windowTitle", type: "string" },
|
{ name: "windowTitle", type: "string" },
|
||||||
{ name: "slotCount", type: "ubyte" },
|
{ name: "slotCount", type: "ubyte" },
|
||||||
{ name: "useProvidedTitle", type: "bool" },
|
|
||||||
{ name: "entityId", type: "int", condition: function(field_values) {
|
{ name: "entityId", type: "int", condition: function(field_values) {
|
||||||
return field_values['inventoryType'] == 11;
|
return field_values['inventoryType'] == 11;
|
||||||
} }
|
} }
|
||||||
|
@ -417,7 +402,7 @@ var packets = {
|
||||||
{ name: "windowId", type: "ubyte" }
|
{ name: "windowId", type: "ubyte" }
|
||||||
]},
|
]},
|
||||||
set_slot: {id: 0x2f, fields: [
|
set_slot: {id: 0x2f, fields: [
|
||||||
{ name: "windowId", type: "ubyte" },
|
{ name: "windowId", type: "byte" },
|
||||||
{ name: "slot", type: "short" },
|
{ name: "slot", type: "short" },
|
||||||
{ name: "item", type: "slot" }
|
{ name: "item", type: "slot" }
|
||||||
]},
|
]},
|
||||||
|
@ -426,42 +411,36 @@ var packets = {
|
||||||
{ name: "count", type: "count", typeArgs: { type: "short", countFor: "items" } },
|
{ name: "count", type: "count", typeArgs: { type: "short", countFor: "items" } },
|
||||||
{ name: "items", type: "array", typeArgs: { type: "slot", count: "count" } }
|
{ name: "items", type: "array", typeArgs: { type: "slot", count: "count" } }
|
||||||
]},
|
]},
|
||||||
craft_progress_bar: {id: 0x31, fields: [
|
craft_progress_bar: {id: 0x31, fields: [ /* TODO: Bad name for this packet imo */
|
||||||
{ name: "windowId", type: "ubyte" },
|
{ name: "windowId", type: "ubyte" },
|
||||||
{ name: "property", type: "short" },
|
{ name: "property", type: "short" },
|
||||||
{ name: "value", type: "short" }
|
{ name: "value", type: "short" }
|
||||||
]},
|
]},
|
||||||
transaction:{id: 0x32, fields: [
|
transaction:{id: 0x32, fields: [
|
||||||
{ name: "windowId", type: "ubyte" },
|
{ name: "windowId", type: "byte" },
|
||||||
{ name: "action", type: "short" },
|
{ name: "action", type: "short" },
|
||||||
{ name: "accepted", type: "bool" }
|
{ name: "accepted", type: "bool" }
|
||||||
]},
|
]},
|
||||||
update_sign: {id: 0x33, fields: [
|
update_sign: {id: 0x33, fields: [
|
||||||
{ name: "x", type: "int" },
|
{ name: "location", type: "position" },
|
||||||
{ name: "y", type: "short" },
|
|
||||||
{ name: "z", type: "int" },
|
|
||||||
{ name: "text1", type: "string" },
|
{ name: "text1", type: "string" },
|
||||||
{ name: "text2", type: "string" },
|
{ name: "text2", type: "string" },
|
||||||
{ name: "text3", type: "string" },
|
{ name: "text3", type: "string" },
|
||||||
{ name: "text4", type: "string" }
|
{ name: "text4", type: "string" }
|
||||||
]},
|
]},
|
||||||
map: {id: 0x34, fields: [
|
map: {id: 0x34, fields: [ /* TODO: No clue how to do this */
|
||||||
{ name: "itemDamage", type: "varint" },
|
{ name: "itemDamage", type: "varint" },
|
||||||
{ name: "dataLength", type: "count", typeArgs: { type: "short", countFor: "data" } },
|
{ name: "dataLength", type: "count", typeArgs: { type: "short", countFor: "data" } },
|
||||||
{ name: "data", type: "buffer", typeArgs: { count: "dataLength" } },
|
{ name: "data", type: "buffer", typeArgs: { count: "dataLength" } },
|
||||||
]},
|
]},
|
||||||
tile_entity_data:{id: 0x35, fields: [
|
tile_entity_data:{id: 0x35, fields: [
|
||||||
{ name: "x", type: "int" },
|
{ name: "location", type: "position" },
|
||||||
{ name: "y", type: "short" },
|
|
||||||
{ name: "z", type: "int" },
|
|
||||||
{ name: "action", type: "ubyte" },
|
{ name: "action", type: "ubyte" },
|
||||||
{ name: "nbtDataLength", type: "count", typeArgs: { type: "short", countFor: "nbtData" } },
|
{ name: "nbtDataLength", type: "count", typeArgs: { type: "short", countFor: "nbtData" } },
|
||||||
{ name: "nbtData", type: "buffer", typeArgs: { count: "nbtDataLength" } },
|
{ name: "nbtData", type: "buffer", typeArgs: { count: "nbtDataLength" } },
|
||||||
]},
|
]},
|
||||||
open_sign_entity: {id: 0x36, fields: [
|
open_sign_entity: {id: 0x36, fields: [
|
||||||
{ name: "x", type: "int" },
|
{ name: "location", type: "position" },
|
||||||
{ name: "y", type: "int" },
|
|
||||||
{ name: "z", type: "int" }
|
|
||||||
]},
|
]},
|
||||||
statistics: {id: 0x37, fields: [
|
statistics: {id: 0x37, fields: [
|
||||||
{ name: "count", type: "count", typeArgs: { type: "varint", countFor: "entries" } },
|
{ name: "count", type: "count", typeArgs: { type: "varint", countFor: "entries" } },
|
||||||
|
@ -472,7 +451,7 @@ var packets = {
|
||||||
]}
|
]}
|
||||||
}}
|
}}
|
||||||
]},
|
]},
|
||||||
player_info: {id: 0x38, fields: [
|
player_info: {id: 0x38, fields: [ /* TODO: Again, no clue */
|
||||||
{ name: "playerName", type: "string" },
|
{ name: "playerName", type: "string" },
|
||||||
{ name: "online", type: "bool" },
|
{ name: "online", type: "bool" },
|
||||||
{ name: "ping", type: "short" }
|
{ name: "ping", type: "short" }
|
||||||
|
@ -488,17 +467,16 @@ var packets = {
|
||||||
]},
|
]},
|
||||||
scoreboard_objective: {id: 0x3b, fields: [
|
scoreboard_objective: {id: 0x3b, fields: [
|
||||||
{ name: "name", type: "string" },
|
{ name: "name", type: "string" },
|
||||||
|
{ name: "action", type: "byte" },
|
||||||
{ name: "displayText", type: "string" },
|
{ name: "displayText", type: "string" },
|
||||||
{ name: "action", type: "byte" }
|
{ name: "type", type: "string"}
|
||||||
]},
|
]},
|
||||||
scoreboard_score: {id: 0x3c, fields: [
|
scoreboard_score: {id: 0x3c, fields: [ /* TODO: itemName and scoreName may need to be switched */
|
||||||
{ name: "itemName", type: "string" },
|
{ name: "itemName", type: "string" },
|
||||||
{ name: "remove", type: "bool" },
|
{ name: "action", type: "byte" },
|
||||||
{ name: "scoreName", type: "string", condition: function(field_values) {
|
{ name: "scoreName", type: "string" },
|
||||||
return !field_values['remove']
|
|
||||||
} },
|
|
||||||
{ name: "value", type: "int", condition: function(field_values) {
|
{ name: "value", type: "int", condition: function(field_values) {
|
||||||
return !field_values['remove']
|
return field_values['action'] != 1;
|
||||||
} }
|
} }
|
||||||
]},
|
]},
|
||||||
scoreboard_display_objective: {id: 0x3d, fields: [
|
scoreboard_display_objective: {id: 0x3d, fields: [
|
||||||
|
@ -534,18 +512,66 @@ var packets = {
|
||||||
]},
|
]},
|
||||||
kick_disconnect: {id: 0x40, fields: [
|
kick_disconnect: {id: 0x40, fields: [
|
||||||
{ name: "reason", type: "string" }
|
{ name: "reason", type: "string" }
|
||||||
|
]},
|
||||||
|
difficulty: { id: 0x41, fields [
|
||||||
|
{ name: "difficulty", type: "ubyte" }
|
||||||
|
]},
|
||||||
|
combat_event: { id: 0x42, fields: [
|
||||||
|
{ name: "event", type: "varint"},
|
||||||
|
{ name: "duration", type: "varint", condition: function(field_values) {
|
||||||
|
return field_values['event'] == 1;
|
||||||
|
} },
|
||||||
|
{ name: "entityId", type: "int", condition: function(field_values) {
|
||||||
|
return field_values['event'] == 1;
|
||||||
|
} },
|
||||||
|
{ name: "playerId", type: "varint", condition: function(field_values) {
|
||||||
|
return field_values['event'] == 2;
|
||||||
|
} },
|
||||||
|
{ name: "entityId", type: "int", condition: function(field_values) {
|
||||||
|
return field_values['event'] == 2;
|
||||||
|
} },
|
||||||
|
{ name: "message", type: "string", condition: function(field_values) {
|
||||||
|
return field_values['event'] == 2;
|
||||||
|
} }
|
||||||
|
]},
|
||||||
|
camera: { id: 0x43, fields: [
|
||||||
|
{ name: "cameraId", type: "varint" }
|
||||||
|
]},
|
||||||
|
world_border: { id: 0x44, fields: [
|
||||||
|
/* TODO: Going to be a pain... */
|
||||||
|
]},
|
||||||
|
title: { id: 0x45, fields: [
|
||||||
|
/* TODO: Going to be a pain too */
|
||||||
|
]},
|
||||||
|
set_compression: { id: 0x46, fields: [
|
||||||
|
{ name: "threshold", type: "varint"}
|
||||||
|
]},
|
||||||
|
playerlist_header: { id: 0x47, fields: [
|
||||||
|
{ name: "header", type: "string" },
|
||||||
|
{ name: "footer", type; "string" }
|
||||||
|
]},
|
||||||
|
resource_pack_send: { id: 0x48, fields: [
|
||||||
|
{ name: "url", type: "string" },
|
||||||
|
{ name: "hash", type: "string" }
|
||||||
|
]},
|
||||||
|
update_entity_nbt: { id: 0x49, fields: [
|
||||||
|
{ name: "entityId": type: "varint" },
|
||||||
|
{ name: "tag", type: "string"} /* TODO: Should be of type "NBT Tag" */
|
||||||
]}
|
]}
|
||||||
},
|
},
|
||||||
toServer: {
|
toServer: {
|
||||||
keep_alive: {id: 0x00, fields: [
|
keep_alive: {id: 0x00, fields: [
|
||||||
{ name: "keepAliveId", type: "int" }
|
{ name: "keepAliveId", type: "int" /* TODO: Int or VarInt */ }
|
||||||
]},
|
]},
|
||||||
chat: {id: 0x01, fields: [
|
chat: {id: 0x01, fields: [
|
||||||
{ name: "message", type: "string" }
|
{ name: "message", type: "string" }
|
||||||
]},
|
]},
|
||||||
use_entity: {id: 0x02, fields: [
|
use_entity: {id: 0x02, fields: [
|
||||||
{ name: "target", type: "int" },
|
{ name: "target", type: "int" /* TODO: Int or VarInt */},
|
||||||
{ name: "mouse", type: "byte" }
|
{ name: "mouse", type: "byte" },
|
||||||
|
{ name: "x", type: "float"},
|
||||||
|
{ name: "y", type: "float"},
|
||||||
|
{ name: "size", type: "float"}
|
||||||
]},
|
]},
|
||||||
flying: {id: 0x03, fields: [
|
flying: {id: 0x03, fields: [
|
||||||
{ name: "onGround", type: "bool" }
|
{ name: "onGround", type: "bool" }
|
||||||
|
@ -564,7 +590,6 @@ var packets = {
|
||||||
]},
|
]},
|
||||||
position_look: {id: 0x06, fields: [
|
position_look: {id: 0x06, fields: [
|
||||||
{ name: "x", type: "double" },
|
{ name: "x", type: "double" },
|
||||||
{ name: "stance", type: "double" },
|
|
||||||
{ name: "y", type: "double" },
|
{ name: "y", type: "double" },
|
||||||
{ name: "z", type: "double" },
|
{ name: "z", type: "double" },
|
||||||
{ name: "yaw", type: "float" },
|
{ name: "yaw", type: "float" },
|
||||||
|
@ -573,15 +598,11 @@ var packets = {
|
||||||
]},
|
]},
|
||||||
block_dig: {id: 0x07, fields: [
|
block_dig: {id: 0x07, fields: [
|
||||||
{ name: "status", type: "byte" },
|
{ name: "status", type: "byte" },
|
||||||
{ name: "x", type: "int" },
|
{ name: "location", type: "position"}
|
||||||
{ name: "y", type: "ubyte" },
|
|
||||||
{ name: "z", type: "int" },
|
|
||||||
{ name: "face", type: "byte" }
|
{ name: "face", type: "byte" }
|
||||||
]},
|
]},
|
||||||
block_place: {id: 0x08, fields: [
|
block_place: {id: 0x08, fields: [
|
||||||
{ name: "x", type: "int" },
|
{ name: "location", type: "position" },
|
||||||
{ name: "y", type: "ubyte" },
|
|
||||||
{ name: "z", type: "int" },
|
|
||||||
{ name: "direction", type: "byte" },
|
{ name: "direction", type: "byte" },
|
||||||
{ name: "heldItem", type: "slot" },
|
{ name: "heldItem", type: "slot" },
|
||||||
{ name: "cursorX", type: "byte" },
|
{ name: "cursorX", type: "byte" },
|
||||||
|
@ -592,19 +613,18 @@ var packets = {
|
||||||
{ name: "slotId", type: "short" }
|
{ name: "slotId", type: "short" }
|
||||||
]},
|
]},
|
||||||
arm_animation: {id: 0x0a, fields: [
|
arm_animation: {id: 0x0a, fields: [
|
||||||
{ name: "entityId", type: "int" },
|
{ name: "entityId", type: "int" }, /* TODO: wiki.vg says this is empty? */
|
||||||
{ name: "animation", type: "byte" }
|
{ name: "animation", type: "byte" }
|
||||||
]},
|
]},
|
||||||
entity_action: {id: 0x0b, fields: [
|
entity_action: {id: 0x0b, fields: [
|
||||||
{ name: "entityId", type: "int" },
|
{ name: "entityId", type: "varint" /* TODO: Int or VarInt */},
|
||||||
{ name: "actionId", type: "byte" },
|
{ name: "actionId", type: "varint" },
|
||||||
{ name: "jumpBoost", type: "int" }
|
{ name: "jumpBoost", type: "varint" /* TODO: Int or VarInt */}
|
||||||
]},
|
]},
|
||||||
steer_vehicle: {id: 0x0c, fields: [
|
steer_vehicle: {id: 0x0c, fields: [
|
||||||
{ name: "sideways", type: "float" },
|
{ name: "sideways", type: "float" },
|
||||||
{ name: "forward", type: "float" },
|
{ name: "forward", type: "float" },
|
||||||
{ name: "jump", type: "bool" },
|
{ name: "jump", type: "ubyte" }
|
||||||
{ name: "unmount", type: "bool" }
|
|
||||||
]},
|
]},
|
||||||
close_window: {id: 0x0d, fields: [
|
close_window: {id: 0x0d, fields: [
|
||||||
{ name: "windowId", type: "byte" }
|
{ name: "windowId", type: "byte" }
|
||||||
|
@ -631,9 +651,7 @@ var packets = {
|
||||||
{ name: "enchantment", type: "byte" }
|
{ name: "enchantment", type: "byte" }
|
||||||
]},
|
]},
|
||||||
update_sign: {id: 0x12, fields: [
|
update_sign: {id: 0x12, fields: [
|
||||||
{ name: "x", type: "int" },
|
{ name: "location", type: "position" },
|
||||||
{ name: "y", type: "short" },
|
|
||||||
{ name: "z", type: "int" },
|
|
||||||
{ name: "text1", type: "string" },
|
{ name: "text1", type: "string" },
|
||||||
{ name: "text2", type: "string" },
|
{ name: "text2", type: "string" },
|
||||||
{ name: "text3", type: "string" },
|
{ name: "text3", type: "string" },
|
||||||
|
@ -645,23 +663,32 @@ var packets = {
|
||||||
{ name: "walkingSpeed", type: "float" }
|
{ name: "walkingSpeed", type: "float" }
|
||||||
]},
|
]},
|
||||||
tab_complete: {id: 0x14, fields: [
|
tab_complete: {id: 0x14, fields: [
|
||||||
{ name: "text", type: "string" }
|
{ name: "text", type: "string" },
|
||||||
|
{ name: "hasPosition", type: "boolean" },
|
||||||
|
{ name: "block", type: "position", condition: function(field_values) {
|
||||||
|
return field_values['hasPosition'];
|
||||||
|
} }
|
||||||
]},
|
]},
|
||||||
settings: {id: 0x15, fields: [
|
settings: {id: 0x15, fields: [
|
||||||
{ name: "locale", type: "string" },
|
{ name: "locale", type: "string" },
|
||||||
{ name: "viewDistance", type: "byte" },
|
{ name: "viewDistance", type: "byte" },
|
||||||
{ name: "chatFlags", type: "byte" },
|
{ name: "chatFlags", type: "byte" },
|
||||||
{ name: "chatColors", type: "bool" },
|
{ name: "chatColors", type: "bool" },
|
||||||
{ name: "difficulty", type: "byte" },
|
{ name: "skinParts", type: "ubyte" }
|
||||||
{ name: "showCape", type: "bool" }
|
|
||||||
]},
|
]},
|
||||||
client_command: {id: 0x16, fields: [
|
client_command: {id: 0x16, fields: [
|
||||||
{ name: "payload", type: "byte" }
|
{ name: "payload", type: "varint" }
|
||||||
]},
|
]},
|
||||||
custom_payload: {id: 0x17, fields: [
|
custom_payload: {id: 0x17, fields: [
|
||||||
{ name: "channel", type: "string" },
|
{ name: "channel", type: "string" }, /* TODO: wiki.vg sats no dataLength is needed? */
|
||||||
{ name: "dataLength", type: "count", typeArgs: { type: "short", countFor: "data" } },
|
{ name: "data", type: "buffer"}
|
||||||
{ name: "data", type: "buffer", typeArgs: { count: "dataLength" } },
|
]},
|
||||||
|
spectate: { id: 0x18, fields: [
|
||||||
|
{ name: "target", type: "UUID"}
|
||||||
|
]},
|
||||||
|
resource_pack_receive: { id: 0x19, fields: [
|
||||||
|
{ name: "hash", type: "string" },
|
||||||
|
{ name: "result", type: "varint" }
|
||||||
]}
|
]}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue