mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-19 06:21:08 +00:00
use prismarine-world : flying-squid has now 9 chunk columns
This commit is contained in:
parent
6cd8ad0013
commit
37e74ae52c
6 changed files with 35 additions and 22 deletions
|
|
@ -4,5 +4,5 @@
|
|||
"maxPlayers": 10,
|
||||
"onlineMode": true,
|
||||
"logging": true,
|
||||
"gameMode": 0
|
||||
"gameMode": 1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ function inject(serv,player)
|
|||
location:position,
|
||||
type:blockType<<4
|
||||
});
|
||||
serv.world.setBlockType(position.x,position.y,position.z,blockType);
|
||||
serv.world.setBlockType(position,blockType);
|
||||
}
|
||||
|
||||
player.changeBlock=changeBlock;
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
var Block=require("prismarine-block")(require("../version"));
|
||||
var Vec3 = require("vec3");
|
||||
|
||||
module.exports=inject;
|
||||
|
||||
function inject(serv,player)
|
||||
{
|
||||
player._client.on("block_dig",function(packet){
|
||||
var b=serv.world.getBlock(packet.location.x,packet.location.y,packet.location.z);
|
||||
currentlyDugBlock=new Block(b.id, b.biome, b.data);
|
||||
var pos=new Vec3(packet.location);
|
||||
currentlyDugBlock=serv.world.getBlock(pos);
|
||||
if(currentlyDugBlock.type==0) return;
|
||||
if(packet.status==0 && player.gameMode!=1)
|
||||
startDigging(packet.location);
|
||||
startDigging(pos);
|
||||
else if(packet.status==2)
|
||||
completeDigging(packet.location);
|
||||
completeDigging(pos);
|
||||
else if(packet.status==1)
|
||||
cancelDigging(packet.location);
|
||||
cancelDigging(pos);
|
||||
else if(packet.status==0 && player.gameMode==1)
|
||||
creativeDigging(packet.location);
|
||||
creativeDigging(pos);
|
||||
});
|
||||
|
||||
function diggingTime(location)
|
||||
|
|
|
|||
|
|
@ -43,12 +43,14 @@ function inject(serv,player)
|
|||
}
|
||||
function sendMap()
|
||||
{
|
||||
player._client.write('map_chunk', {
|
||||
x: 0,
|
||||
z: 0,
|
||||
groundUp: true,
|
||||
bitMap: 0xffff,
|
||||
chunkData: serv.world.dump()
|
||||
serv.world.getColumns().forEach(function(column){
|
||||
player._client.write('map_chunk', {
|
||||
x: column.chunkX,
|
||||
z: column.chunkZ,
|
||||
groundUp: true,
|
||||
bitMap: 0xffff,
|
||||
chunkData: column.column.dump()
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
var World = require('prismarine-chunk');
|
||||
var Chunk = require('prismarine-chunk')(require("../version"));
|
||||
var World = require('prismarine-world');
|
||||
var Vec3 = require('vec3');
|
||||
|
||||
module.exports=inject;
|
||||
|
||||
|
|
@ -6,12 +8,20 @@ function inject(serv) {
|
|||
|
||||
serv.world=new World();
|
||||
|
||||
for (var x = 0; x < 16;x++) {
|
||||
for (var z = 0; z < 16; z++) {
|
||||
serv.world.setBlockType(x, 50, z, 2);
|
||||
for (var y = 0; y < 256; y++) {
|
||||
serv.world.setSkyLight(x, y, z, 15);
|
||||
for(var chunkX=-1;chunkX<2;chunkX++)
|
||||
{
|
||||
for(var chunkZ=-1;chunkZ<2;chunkZ++)
|
||||
{
|
||||
var chunk=new Chunk();
|
||||
for (var x = 0; x < 16;x++) {
|
||||
for (var z = 0; z < 16; z++) {
|
||||
chunk.setBlockType(new Vec3(x, 50, z), 2);
|
||||
for (var y = 0; y < 256; y++) {
|
||||
chunk.setSkyLight(new Vec3(x, y, z), 15);
|
||||
}
|
||||
}
|
||||
}
|
||||
serv.world.setColumn(chunkX,chunkZ,chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -25,7 +25,8 @@
|
|||
"buffers": "0.1.1",
|
||||
"mocha": "~2.2.5",
|
||||
"chai": "~3.2.0",
|
||||
"prismarine-chunk": "~0.1.0",
|
||||
"prismarine-chunk": "git://github.com/rom1504/prismarine-chunk.git#use-prismarine-block",
|
||||
"prismarine-world": "git://github.com/rom1504/prismarine-world.git#implementation",
|
||||
"vec3": "0.1.3",
|
||||
"requireindex": "~1.0.0",
|
||||
"prismarine-block": "0.1.0",
|
||||
|
|
|
|||
Loading…
Reference in a new issue