From ea023b3374377fba342385b4f26499a97478e550 Mon Sep 17 00:00:00 2001 From: valoeghese Date: Tue, 25 Feb 2020 21:29:08 +1300 Subject: [PATCH] basic chunk gen --- .../github/halotroop/litecraft/world/Chunk.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/com/github/halotroop/litecraft/world/Chunk.java b/src/main/java/com/github/halotroop/litecraft/world/Chunk.java index 6046bed..ae3154a 100644 --- a/src/main/java/com/github/halotroop/litecraft/world/Chunk.java +++ b/src/main/java/com/github/halotroop/litecraft/world/Chunk.java @@ -77,6 +77,20 @@ public class Chunk implements TileAccess } } + public static Chunk generateChunk(int chunkX, int chunkY, int chunkZ) { + Chunk result = new Chunk(chunkX, chunkY, chunkZ); + + for (int x = 0; x < 7; ++x) { + for (int z = 0; z < 7; ++z) { + for (int y = 0; y < 7; ++y) { + result.setBlock(x, y, z, y == 7 ? Block.GRASS : Block.DIRT); + } + } + } + + return result; + } + public void setRender(boolean render) { if (render && !this.render) // if it has been changed to true