2024-10-26 14:24:38 +01:00
|
|
|
import Block from "../../blocks/Block";
|
|
|
|
import Chunk from "../../Chunk";
|
|
|
|
import IGenerator from "../IGenerator";
|
2023-04-08 20:52:47 +01:00
|
|
|
|
2024-10-26 14:24:38 +01:00
|
|
|
export default class FlatGenerator implements IGenerator {
|
2023-04-08 20:52:47 +01:00
|
|
|
public generate(chunk:Chunk) {
|
|
|
|
for (let x = 0; x < 16; x++) {
|
|
|
|
for (let z = 0; z < 16; z++) {
|
|
|
|
for (let y = 0; y < 128; y++) {
|
|
|
|
if (y === 63) {
|
|
|
|
chunk.setBlock(Block.grass.blockId, x, y, z);
|
|
|
|
} else if (y === 62 || y === 61) {
|
|
|
|
chunk.setBlock(Block.dirt.blockId, x, y, z);
|
|
|
|
} else if (y === 0) {
|
|
|
|
chunk.setBlock(Block.bedrock.blockId, x, y, z);
|
|
|
|
} else if (y < 61) {
|
|
|
|
chunk.setBlock(Block.stone.blockId, x, y, z);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|