implement mojang lightning of a1.2.6

This commit is contained in:
LabyStudio
2022-02-01 21:08:09 +01:00
parent 76e7f9fd84
commit 14c13297fb
12 changed files with 458 additions and 158 deletions
@@ -1,6 +1,6 @@
window.Block = class {
static blocks = [];
static blocks = new Map();
static create() {
Block.STONE = new BlockStone(1, 0);
@@ -19,7 +19,7 @@ window.Block = class {
this.boundingBox = new BoundingBox(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
// Register block
Block.blocks[id] = this;
Block.blocks.set(id, this);
}
getId() {
@@ -39,6 +39,10 @@ window.Block = class {
return typeId === 0 || Block.getById(typeId).isTransparent();
}
getLightValue() {
return 0;
}
isSolid() {
return true;
}
@@ -167,7 +171,7 @@ window.Block = class {
}
static getById(typeId) {
return Block.blocks[typeId];
return Block.blocks.get(typeId);
}
}