add serv.reloadChunk and update prismarine-chunk and prismarine-world

This commit is contained in:
Romain Beaumont 2016-01-17 18:01:01 +01:00
parent 1851c75b1f
commit 756d3a8d11
2 changed files with 13 additions and 2 deletions

View file

@ -34,12 +34,12 @@
"node-promise-es6": "^0.3.0",
"node-uuid": "^1.4.3",
"prismarine-block": "0.1.0",
"prismarine-chunk": "0.2.1",
"prismarine-chunk": "0.3.2",
"prismarine-entity": "0.2.0",
"prismarine-item": "0.0.0",
"prismarine-provider-anvil": "^0.2.0",
"prismarine-windows": "0.0.0",
"prismarine-world": "0.4.0",
"prismarine-world": "0.5.4",
"prismarine-world-sync": "0.1.0",
"random-seed": "^0.2.0",
"range": "0.0.3",

View file

@ -66,6 +66,17 @@ module.exports.server=async function(serv,{worldFolder,generation={"name":"diamo
await world.setBlockData(position,blockData);
};
serv.reloadChunks = (world,chunks) => {
serv.players
.filter(player => player.world==world)
.forEach(oPlayer => {
chunks
.filter(({chunkX,chunkZ}) => oPlayer.loadedChunks[chunkX+","+chunkZ]!==undefined)
.forEach(({chunkX,chunkZ}) => oPlayer.unloadChunk(chunkX,chunkZ));
oPlayer.sendRestMap();
})
};
//serv.pregenWorld(serv.overworld).then(() => serv.log('Pre-Generated Overworld'));
//serv.pregenWorld(serv.netherworld).then(() => serv.log('Pre-Generated Nether'));
};