mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-19 14:31:17 +00:00
make the program crash in case of errors
This commit is contained in:
parent
17b65f5021
commit
24370e9d0f
3 changed files with 24 additions and 14 deletions
|
|
@ -7,19 +7,24 @@ function inject(serv, player)
|
|||
player._client.on('block_place', async function (packet) {
|
||||
var referencePosition=new vec3(packet.location.x,packet.location.y,packet.location.z);
|
||||
if (player.entity.crouching) return;
|
||||
var id = await serv.world.getBlockType(referencePosition);
|
||||
var blockAbove = await serv.world.getBlockType(referencePosition.clone().add(new vec3(0, 1, 0)));
|
||||
try {
|
||||
var id = await serv.world.getBlockType(referencePosition);
|
||||
var blockAbove = await serv.world.getBlockType(referencePosition.clone().add(new vec3(0, 1, 0)));
|
||||
|
||||
if(id==54) {
|
||||
if (blockAbove) {
|
||||
return;
|
||||
if (id == 54) {
|
||||
if (blockAbove) {
|
||||
return;
|
||||
}
|
||||
player._client.write("open_window", {
|
||||
windowId: 165,
|
||||
inventoryType: "minecraft:chest",
|
||||
windowTitle: JSON.stringify("Chest"),
|
||||
slotCount: 9 * 3 + 8 // 3 rows, make nicer later
|
||||
});
|
||||
}
|
||||
player._client.write("open_window",{
|
||||
windowId:165,
|
||||
inventoryType:"minecraft:chest",
|
||||
windowTitle:JSON.stringify("Chest"),
|
||||
slotCount:9*3 + 8 // 3 rows, make nicer later
|
||||
});
|
||||
}
|
||||
catch(err) {
|
||||
setTimeout(function(){throw err;},0);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ function inject(serv,player)
|
|||
cancelDigging(pos);
|
||||
else if(packet.status==0 && player.gameMode==1)
|
||||
creativeDigging(pos);
|
||||
});
|
||||
})
|
||||
.catch((err)=> setTimeout(function(){throw err;},0));
|
||||
});
|
||||
|
||||
function diggingTime(location)
|
||||
|
|
|
|||
|
|
@ -94,13 +94,17 @@ function inject(serv,player)
|
|||
function sendRestMap()
|
||||
{
|
||||
player.sendingChunks=true;
|
||||
sendChunksAroundPlayer(player.view).then(() => player.sendingChunks=false);
|
||||
sendChunksAroundPlayer(player.view)
|
||||
.then(() => player.sendingChunks=false)
|
||||
.catch((err)=> setTimeout(function(){throw err;},0));
|
||||
|
||||
player.on("positionChanged",function(){
|
||||
if(!player.sendingChunks && player.entity.position.distanceTo(player.lastPositionChunkUpdated)>16*32)
|
||||
{
|
||||
player.sendingChunks=true;
|
||||
sendChunksAroundPlayer(player.view).then(() => player.sendingChunks=false);
|
||||
sendChunksAroundPlayer(player.view)
|
||||
.then(() => player.sendingChunks=false)
|
||||
.catch((err)=> setTimeout(function(){throw err;},0));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue