mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-19 14:31:17 +00:00
add _worldSync to implement modpe api
This commit is contained in:
parent
32c1368107
commit
316ed6b49b
3 changed files with 6 additions and 4 deletions
|
|
@ -37,7 +37,8 @@
|
|||
"vec3": "0.1.3",
|
||||
"spiralloop": "1.0.2",
|
||||
"node-dir": "~0.1.9",
|
||||
"uuid-1345": "~0.99.6"
|
||||
"uuid-1345": "~0.99.6",
|
||||
"prismarine-world-sync": "0.1.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ function modpeApi() {
|
|||
}
|
||||
|
||||
function getTile(x, y, z) {
|
||||
server.world.getBlockType(new vec3(x, y, z));
|
||||
return server._worldSync.getBlockType(new vec3(x, y, z));
|
||||
}
|
||||
|
||||
function preventDefault() {
|
||||
|
|
@ -161,7 +161,6 @@ function inject(serv,settings)
|
|||
|
||||
player._client.on("block_dig", function (packet) {
|
||||
var pos = new vec3(packet.location);
|
||||
var currentlyDugBlock = serv.world.getBlock(pos);
|
||||
if (packet.status == 0 && player.gameMode != 1)
|
||||
startDestroyBlock(pos.x, pos.y, pos.z, 0);
|
||||
else if (packet.status == 2)
|
||||
|
|
@ -180,7 +179,7 @@ function inject(serv,settings)
|
|||
if (packet.location.y < 0) return;
|
||||
useItem(packet.location.x, packet.location.y, packet.location.z,
|
||||
packet.heldItem.blockId,
|
||||
serv.world.getBlockType(new vec3(packet.location.x, packet.location.y, packet.location.z)));
|
||||
serv._worldSync.getBlockType(new vec3(packet.location.x, packet.location.y, packet.location.z)));
|
||||
});
|
||||
|
||||
player.on('modpe', function (command) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
var Chunk = require('prismarine-chunk')(require("../version"));
|
||||
var World = require('prismarine-world');
|
||||
var Vec3 = require('vec3');
|
||||
var WorldSync = require("prismarine-world-sync");
|
||||
|
||||
var generations={
|
||||
'grass_field':require("../worldGenerations/grass_field"),
|
||||
|
|
@ -15,4 +16,5 @@ function inject(serv,options) {
|
|||
options["generation"].options.seed=options["generation"].options.seed || Math.random()*Math.pow(2, 32);
|
||||
serv.emit("seed",options["generation"].options.seed);
|
||||
serv.world = new World(generations[options["generation"].name](options["generation"].options));
|
||||
serv._worldSync=new WorldSync(serv.world);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue