From 3006fd44bf0ccd0d0dd72bfe8408f050b12e7de5 Mon Sep 17 00:00:00 2001 From: mhsjlw Date: Sat, 14 May 2016 21:26:38 -0400 Subject: [PATCH] update to version 2.1.0 (protocol 60) --- HISTORY.md | 4 +++ README.md | 2 +- data/protocol.json | 66 +++++++++++++++++++++++++++++---------------- examples/client.js | 8 +++--- examples/server.js | 10 ++++--- package.json | 2 +- src/createClient.js | 6 ++--- 7 files changed, 62 insertions(+), 36 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 71891e6..8a79927 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,7 @@ +## 2.1.0 +* normalize names of packet fields +* update to version 0.14.2 + ## 2.0.1 * player list is now an array * reconnecting has been fixed diff --git a/README.md b/README.md index b41d9f4..147f05e 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Parse and serialize Minecraft PE packets. ## Features - * Supports Minecraft PE `0.14.1` + * Supports Minecraft PE `0.14.2` * Pure JavaScript * Easily send and listen for any packet * RakNet support through [node-raknet](https://github.com/mhsjlw/node-raknet) diff --git a/data/protocol.json b/data/protocol.json index 403fdea..81b1a91 100644 --- a/data/protocol.json +++ b/data/protocol.json @@ -27,7 +27,7 @@ ] }, { - "name": "resultCount", + "name": "result_count", "type": "i32" }, { @@ -79,7 +79,7 @@ ] }, { - "name": "resultCount", + "name": "result_count", "type": "i32" }, { @@ -175,15 +175,15 @@ "4": "lstring", "5": ["container",[ { - "name":"blockId", + "name":"block_id", "type":"li16" }, { - "name":"itemCount", + "name":"item_count", "type":"li8" }, { - "name":"itemDamage", + "name":"item_damage", "type":"li16" } ]], @@ -267,7 +267,7 @@ "container", [ { - "name": "blockId", + "name": "block_id", "type": "i16" }, { @@ -275,7 +275,7 @@ "type": [ "switch", { - "compareTo": "blockId", + "compareTo": "block_id", "fields": { "0": "void" }, @@ -283,15 +283,15 @@ "container", [ { - "name": "itemCount", + "name": "item_count", "type": "i8" }, { - "name": "itemDamage", + "name": "item_damage", "type": "i16" }, { - "name": "nbtData", + "name": "nbt_data", "type": ["buffer",{"countType":"li16"}] } ] @@ -320,7 +320,7 @@ "container", [ { - "name": "skinType", + "name": "skin_type", "type": "string" }, { @@ -354,7 +354,7 @@ "bitfield", [ { - "name": "blockData", + "name": "block_data", "size": 4, "signed": false }, @@ -401,11 +401,11 @@ "container", [ { - "name": "minValue", + "name": "min_value", "type": "f32" }, { - "name": "maxValue", + "name": "max_value", "type": "f32" }, { @@ -432,15 +432,15 @@ "type": "i64" }, { - "name": "motX", + "name": "mot_x", "type": "f32" }, { - "name": "motY", + "name": "mot_y", "type": "f32" }, { - "name": "motZ", + "name": "mot_z", "type": "f32" } ] @@ -509,7 +509,7 @@ "type": "f32" }, { - "name": "headYaw", + "name": "head_yaw", "type": "f32" }, { @@ -891,8 +891,20 @@ "type": "f32" }, { - "name": "unknown", + "name": "unknown1", "type": "i8" + }, + { + "name": "unknown2", + "type": "i8" + }, + { + "name": "unknown3", + "type": "i8" + }, + { + "name": "unknown4", + "type": "string" } ] ], @@ -1742,6 +1754,14 @@ { "name": "flags", "type": "i32" + }, + { + "name": "user_permission", + "type": "i32" + }, + { + "name": "global_permission", + "type": "i32" } ] ], @@ -1818,15 +1838,15 @@ "container", [ { - "name": "clientUuid", + "name": "client_uuid", "type": "uuid" }, { - "name": "entityId", + "name": "entity_id", "type": "i64" }, { - "name": "displayName", + "name": "display_name", "type": "string" }, { @@ -1839,7 +1859,7 @@ "container", [ { - "name": "clientUuid", + "name": "client_uuid", "type": "uuid" } ] diff --git a/examples/client.js b/examples/client.js index 75879bc..23cf199 100644 --- a/examples/client.js +++ b/examples/client.js @@ -11,14 +11,14 @@ var client = pmp.createClient({ username:process.argv[4] }); -client.on('mcpe',packet => console.log(packet)); +client.on('mcpe', packet => console.log(packet)); -client.on('set_spawn_position',() => { - client.writeMCPE('request_chunk_radius',{ +client.on('set_spawn_position', () => { + client.writeMCPE('request_chunk_radius', { chunk_radius:8 }) }); client.on('error',function(err){ console.log(err); -}); \ No newline at end of file +}); diff --git a/examples/server.js b/examples/server.js index 1aa97ea..ccf2fbb 100644 --- a/examples/server.js +++ b/examples/server.js @@ -11,7 +11,7 @@ if(process.argv.length !=4) { var server = pmp.createServer({ host: process.argv[2], port: parseInt(process.argv[3]), - name: 'MCPE;Minecraft: PE Server;45 45;0.14.1;0;20' + name: 'MCPE;Minecraft: PE Server;60 60;0.14.2;0;20' }); server.on('connection', function(client) { @@ -19,7 +19,6 @@ server.on('connection', function(client) { client.on("mcpe",packet => console.log(packet)); - client.on("game_login",packet => { client.writeMCPE("player_status",{ status:0 @@ -48,7 +47,10 @@ server.on('connection', function(client) { x:0, y:1+1.62, z:0, - unknown:0 + unknown1:0, + unknown2:0, + unknown3:0, + unknown4:"" }); client.writeMCPE('set_spawn_position', { @@ -102,4 +104,4 @@ server.on('connection', function(client) { client.on('end',function() { console.log("client left"); }) -}); \ No newline at end of file +}); diff --git a/package.json b/package.json index 63489a5..0994521 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pocket-minecraft-protocol", - "version": "2.0.1", + "version": "2.1.0", "description": "Parse and serialize Minecraft PE packets", "main": "index.js", "scripts": { diff --git a/src/createClient.js b/src/createClient.js index 235d585..255b2d0 100644 --- a/src/createClient.js +++ b/src/createClient.js @@ -33,8 +33,8 @@ function createClient(options) { client.writeMCPE('game_login', { username: client.username, - protocol: 46, - protocol2: 46, + protocol: 60, + protocol2: 60, client_id: [ -1, -697896776 ], client_uuid: '86372ed8-d055-b23a-9171-5e3ac594d766', server_address: client.host+":"+client.port, @@ -58,4 +58,4 @@ function createClient(options) { return client; } -module.exports = createClient; \ No newline at end of file +module.exports = createClient;