we don't need to floor this

it's an integer and we're doing a bit shift on it lmao.
This commit is contained in:
Holly Stubbs 2021-10-19 08:17:18 +01:00
parent f4d635a32c
commit ca164e1c0a
Signed by: tgpholly
GPG Key ID: B8583C4B7D18119E
1 changed files with 10 additions and 2 deletions

View File

@ -97,6 +97,14 @@ module.exports = class {
this.workPool.add([false, ["generate", cx, cz, null]]);
}
chunkExists(cx = 0, cz = 0) {
if (this.chunks[cx] == null) return false;
if (this.chunks[cx][cz] == null) return false;
// In any other case the chunk exists
return true;
}
multiBlockChunk(chunkX = 0, chunkZ = 0, user) {
this.workPool.add([false, ["chunk", [chunkX, chunkZ, this.chunks[chunkX][chunkZ]], user.id, null]]);
}
@ -104,8 +112,8 @@ module.exports = class {
setBlock(id = 0, x = 0, y = 0, z = 0) {
if (y < 0 || y > 127) return console.error("Tried to set a block outside of the world!");
const chunkX = Math.floor(x >> 4);
const chunkZ = Math.floor(z >> 4);
const chunkX = x >> 4;
const chunkZ = z >> 4;
const blockX = x - (16 * chunkX);
const blockZ = z - (16 * chunkZ);