diff --git a/examples/server.js b/examples/server.js index ffc36c8..3e79cf6 100644 --- a/examples/server.js +++ b/examples/server.js @@ -24,39 +24,74 @@ server.on('connection', function(client) { client.writeMCPE("mcpe_player_status",{ status:0 }); + client.writeMCPE('mcpe_move_player', { + entity_id: [0,0], + x: 1, + y: 64 + 1.62, + z: 1, + yaw: 0, + head_yaw: 0, + pitch: 0, + mode: 0, + on_ground: 1 + }); + client.writeMCPE("mcpe_start_game",{ - seed:0, + seed:-1, dimension:0, - generator:0, + generator:1, gamemode:0, - entity_id:0, - spawn_x:0, - spawn_y:64, - spawn_z:0, + entity_id:[0,0], + spawn_x:1, + spawn_y:1, + spawn_z:1, x:0, - y:64, + y:1+1.62, z:0, unknown:0 }); + + client.writeMCPE('mcpe_set_spawn_position', { + x: 1, + y: 64, + z: 1 + }); client.writeMCPE("mcpe_set_time",{ time:0, - started:0 - }) + started:1 + }); + + client.writeMCPE('mcpe_respawn', { + x: 1, + y: 64, + z: 1 + }); }); client.on("mcpe_request_chunk_radius",packet => { const chunkRadius = packet.chunk_radius; // TODO : to fix, no idea what to send - for (let x = 5; x < 6; x++) { - for (let z = 2; z < 3; z++) { + + for (let x = 0; x < 1; x++) { + for (let z = 0; z < 1; z++) { client.writeBatch([{"name":"mcpe","params":{name:"mcpe_full_chunk_data",params:{ chunk_x: x, chunk_z: z, order: 1, chunk_data:fs.readFileSync(__dirname+"/chunk") - }}}]); + }}}]); + } } - } + + client.writeMCPE('mcpe_player_status', { + status: 3 + }); + + client.writeMCPE('mcpe_set_time', { + time: 0, + started: 1 + }); + }); client.on('error', function(err) {