From 3121c0fdcc8daffb0788f077db54fa2ad2e51859 Mon Sep 17 00:00:00 2001 From: Will Franzen Date: Tue, 30 Dec 2014 13:06:48 -0600 Subject: [PATCH] Switch to varint where I was doubting wiki.vg --- lib/protocol.js | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/protocol.js b/lib/protocol.js index af80e2e..1c68f6f 100644 --- a/lib/protocol.js +++ b/lib/protocol.js @@ -76,7 +76,7 @@ var packets = { play: { toClient: { keep_alive: {id: 0x00, fields: [ - { name: "keepAliveId", type: "int" /* TODO: Int or VarInt */ }, + { name: "keepAliveId", type: "varint" }, ]}, login: {id: 0x01, fields: [ { name: "entityId", type: "int" }, @@ -96,7 +96,7 @@ var packets = { { name: "time", type: "long" }, ]}, entity_equipment: {id: 0x04, fields: [ - { name: "entityId", type: "int" /* TODO: Int or VarInt */ }, + { name: "entityId", type: "varint" }, { name: "slot", type: "short" }, { name: "item", type: "slot" } ]}, @@ -145,8 +145,8 @@ var packets = { { name: "metadata", type: "entityMetadata" } ]}, collect: {id: 0x0d, fields: [ - { name: "collectedEntityId", type: "int" /* TODO: Int or VarInt */}, - { name: "collectorEntityId", type: "int" /* TODO: Int or VarInt */} + { name: "collectedEntityId", type: "varint" }, + { name: "collectorEntityId", type: "varint" } ]}, spawn_entity: {id: 0x0e, fields: [ { name: "entityId", type: "varint" }, @@ -210,20 +210,20 @@ var packets = { { name: "entityId", type: "int" } ]}, rel_entity_move: {id: 0x15, fields: [ - { name: "entityId", type: "int" }, /* TODO: Int or VarInt */ + { name: "entityId", type: "varint" }, { name: "dX", type: "byte" }, { name: "dY", type: "byte" }, { name: "dZ", type: "byte" }, { name: "onGround", type: "bool"} ]}, entity_look: {id: 0x16, fields: [ - { name: "entityId", type: "int" }, /* TODO: Int or VarInt */ + { name: "entityId", type: "varint" }, { name: "yaw", type: "byte" }, { name: "pitch", type: "byte" }, { name: "onGround", type: "bool"} ]}, entity_move_look: {id: 0x17, fields: [ - { name: "entityId", type: "int" }, /* TODO: Int or VarInt */ + { name: "entityId", type: "varint" }, { name: "dX", type: "byte" }, { name: "dY", type: "byte" }, { name: "dZ", type: "byte" }, @@ -232,7 +232,7 @@ var packets = { { name: "onGround", type: "bool"} ]}, entity_teleport: {id: 0x18, fields: [ - { name: "entityId", type: "int" }, /* TODO: Int or VarInt */ + { name: "entityId", type: "varint" }, { name: "x", type: "int" }, { name: "y", type: "int" }, { name: "z", type: "int" }, @@ -241,7 +241,7 @@ var packets = { { name: "onGround", type: "bool"} ]}, entity_head_rotation: {id: 0x19, fields: [ - { name: "entityId", type: "int" }, /* TODO: Int or VarInt */ + { name: "entityId", type: "varint" }, { name: "headYaw", type: "byte" }, ]}, entity_status: {id: 0x1a, fields: [ @@ -254,18 +254,18 @@ var packets = { { name: "leash", type: "bool" } ]}, entity_metadata: {id: 0x1c, fields: [ - { name: "entityId", type: "int" }, /* TODO: Int or VarInt */ + { name: "entityId", type: "varint" }, { name: "metadata", type: "entityMetadata" } ]}, entity_effect: {id: 0x1d, fields: [ - { name: "entityId", type: "int" }, /* TODO: Int or VarInt */ + { name: "entityId", type: "varint" }, { name: "effectId", type: "byte" }, { name: "amplifier", type: "byte" }, { name: "duration", type: "varint" }, { name: "hideParticles", type: "bool" } ]}, remove_entity_effect: {id: 0x1e, fields: [ - { name: "entityId", type: "int" }, /* TODO: Int or VarInt */ + { name: "entityId", type: "varint" }, { name: "effectId", type: "byte" } ]}, experience: {id: 0x1f, fields: [ @@ -274,7 +274,7 @@ var packets = { { name: "totalExperience", type: "varint" } ]}, update_attributes: {id: 0x20, fields: [ - { name: "entityId", type: "int" }, /* TODO: Int or VarInt */ + { name: "entityId", type: "varint" }, { name: "count", type: "count", typeArgs: { type: "int", countFor: "properties" } }, { name: "properties", type: "array", typeArgs: { count: "count", type: "container", typeArgs: { fields: [ @@ -295,8 +295,8 @@ var packets = { { name: "z", type: "int" }, { name: "groundUp", type: "bool" }, { name: "bitMap", type: "ushort" }, - { name: "chunkDataLength", type: "count", typeArgs: { type: "int", countFor: "compressedChunkData" } }, /* TODO: Int or VarInt */ - { name: "chunkData", type: "buffer", typeArgs: { count: "compressedChunkDataLength" } }, + { name: "chunkDataLength", type: "count", typeArgs: { type: "varint", countFor: "chunkData" } }, + { name: "chunkData", type: "buffer", typeArgs: { count: "chunkDataLength" } }, ]}, multi_block_change: {id: 0x22, fields: [ { name: "chunkX", type: "int" }, @@ -600,13 +600,13 @@ var packets = { }, toServer: { keep_alive: {id: 0x00, fields: [ - { name: "keepAliveId", type: "int" /* TODO: Int or VarInt */ } + { name: "keepAliveId", type: "varint" } ]}, chat: {id: 0x01, fields: [ { name: "message", type: "string" } ]}, use_entity: {id: 0x02, fields: [ - { name: "target", type: "int" /* TODO: Int or VarInt */}, + { name: "target", type: "varint" }, { name: "mouse", type: "byte" }, { name: "x", type: "float"}, { name: "y", type: "float"}, @@ -656,9 +656,9 @@ var packets = { { name: "animation", type: "byte" } ]}, entity_action: {id: 0x0b, fields: [ - { name: "entityId", type: "varint" /* TODO: Int or VarInt */}, + { name: "entityId", type: "varint" }, { name: "actionId", type: "varint" }, - { name: "jumpBoost", type: "varint" /* TODO: Int or VarInt */} + { name: "jumpBoost", type: "varint" } ]}, steer_vehicle: {id: 0x0c, fields: [ { name: "sideways", type: "float" },