implement new terrain generator, cave generator, tree generator, implement big tree generator, improve light update performance

This commit is contained in:
LabyStudio
2022-05-04 23:35:53 +02:00
parent b52a1385b3
commit d846613ca9
21 changed files with 1380 additions and 196 deletions
+6 -1
View File
@@ -16,6 +16,7 @@ export default class Chunk {
this.group.chunkZ = z;
this.loaded = false;
this.isTerrainPopulated = false;
// Initialize sections
this.sections = [];
@@ -75,7 +76,7 @@ export default class Chunk {
let typeId = section.getBlockAt(x, y & 15, z);
let block = Block.getById(typeId);
let opacity = block.getOpacity();
let opacity = typeId === 0 ? 0 : block.getOpacity();
let blockLight = typeId === 0 ? 0 : block.getLightValue();
if (opacity === 0) {
@@ -322,6 +323,10 @@ export default class Chunk {
return this.loaded;
}
unload() {
this.loaded = false;
}
setModifiedAllSections() {
for (let y = 0; y < this.sections.length; y++) {
this.sections[y].isModified = true;