mirror of
https://github.com/danbulant/flying-squid
synced 2026-07-07 12:10:46 +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) {
|
player._client.on('block_place', async function (packet) {
|
||||||
var referencePosition=new vec3(packet.location.x,packet.location.y,packet.location.z);
|
var referencePosition=new vec3(packet.location.x,packet.location.y,packet.location.z);
|
||||||
if (player.entity.crouching) return;
|
if (player.entity.crouching) return;
|
||||||
var id = await serv.world.getBlockType(referencePosition);
|
try {
|
||||||
var blockAbove = await serv.world.getBlockType(referencePosition.clone().add(new vec3(0, 1, 0)));
|
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 (id == 54) {
|
||||||
if (blockAbove) {
|
if (blockAbove) {
|
||||||
return;
|
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,
|
catch(err) {
|
||||||
inventoryType:"minecraft:chest",
|
setTimeout(function(){throw err;},0);
|
||||||
windowTitle:JSON.stringify("Chest"),
|
|
||||||
slotCount:9*3 + 8 // 3 rows, make nicer later
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@ function inject(serv,player)
|
||||||
cancelDigging(pos);
|
cancelDigging(pos);
|
||||||
else if(packet.status==0 && player.gameMode==1)
|
else if(packet.status==0 && player.gameMode==1)
|
||||||
creativeDigging(pos);
|
creativeDigging(pos);
|
||||||
});
|
})
|
||||||
|
.catch((err)=> setTimeout(function(){throw err;},0));
|
||||||
});
|
});
|
||||||
|
|
||||||
function diggingTime(location)
|
function diggingTime(location)
|
||||||
|
|
|
||||||
|
|
@ -94,13 +94,17 @@ function inject(serv,player)
|
||||||
function sendRestMap()
|
function sendRestMap()
|
||||||
{
|
{
|
||||||
player.sendingChunks=true;
|
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(){
|
player.on("positionChanged",function(){
|
||||||
if(!player.sendingChunks && player.entity.position.distanceTo(player.lastPositionChunkUpdated)>16*32)
|
if(!player.sendingChunks && player.entity.position.distanceTo(player.lastPositionChunkUpdated)>16*32)
|
||||||
{
|
{
|
||||||
player.sendingChunks=true;
|
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