mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-24 17:21:43 +00:00
Changes
This commit is contained in:
parent
be576b7494
commit
38934cb05e
1 changed files with 28 additions and 5 deletions
33
app.js
33
app.js
|
|
@ -5,6 +5,8 @@ var World = require('prismarine-chunk');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var timeStarted = Math.floor(new Date() / 1000).toString();
|
var timeStarted = Math.floor(new Date() / 1000).toString();
|
||||||
var playersConnected = [];
|
var playersConnected = [];
|
||||||
|
var playerMoveData = [];
|
||||||
|
var playerLookData = [];
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
motd: settings.motd,
|
motd: settings.motd,
|
||||||
|
|
@ -39,11 +41,11 @@ server.on('login', function(client) {
|
||||||
client.write('named_entity_spawn', {
|
client.write('named_entity_spawn', {
|
||||||
entityId: entry.id,
|
entityId: entry.id,
|
||||||
playerUUID: entry.uuid,
|
playerUUID: entry.uuid,
|
||||||
x: 6,
|
x: playerMoveData[entry.uuid].x,
|
||||||
y: 53,
|
y: playerMoveData[entry.uuid].y,
|
||||||
z: 6,
|
z: playerMoveData[entry.uuid].z,
|
||||||
yaw: 0,
|
yaw: playerLookData[entry.uuid],
|
||||||
pitch: 0,
|
pitch: playerLookData[entry.uuid],
|
||||||
currentItem: 0,
|
currentItem: 0,
|
||||||
metadata: []
|
metadata: []
|
||||||
});
|
});
|
||||||
|
|
@ -92,6 +94,27 @@ server.on('login', function(client) {
|
||||||
log("[INFO]: " + client.username+' disconnected', '('+addr+')');
|
log("[INFO]: " + client.username+' disconnected', '('+addr+')');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
client.on('position', function(packet) {
|
||||||
|
playerMoveData[client.uuid] = { x: packet.x, y: packet.y, z: packet.z, id: packet.id, onGround: packet.onGround};
|
||||||
|
client.write('rel_entity_move', {
|
||||||
|
entityId: playerMoveData[client.uuid].id,
|
||||||
|
dX: playerMoveData[client.uuid].x,
|
||||||
|
dY: playerMoveData[client.uuid].y,
|
||||||
|
dZ: playerMoveData[client.uuid].z,
|
||||||
|
onGround: playerMoveData[client.uuid].onGround
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('position_look', function(packet) {
|
||||||
|
playerLookData[client.uuid] = { x: packet.yaw, y: packet.pitch, id: packet.id, onGround: packet.onGround};
|
||||||
|
client.write('entity_look', {
|
||||||
|
entityId: playerLookData[client.uuid].id,
|
||||||
|
yaw: playerLookData[client.uuid].yaw,
|
||||||
|
pitch: playerLookData[client.uuid].pitch,
|
||||||
|
onGround: playerLookData[client.uuid].onGround
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
client.on('error', function(error) {
|
client.on('error', function(error) {
|
||||||
console.log('[ERR] ' + error.stack);
|
console.log('[ERR] ' + error.stack);
|
||||||
log('[ERR]: Client: ' + error.stack);
|
log('[ERR]: Client: ' + error.stack);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue