From 94c8baa61399cc924dc514f2ce8d1f9599d46827 Mon Sep 17 00:00:00 2001 From: Forwolk Date: Sun, 5 Aug 2018 19:36:59 +0300 Subject: [PATCH] fix: Simple chunk section --- .../mc/world/flat/SimpleChunkSection.java | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 flat_world/src/main/java/mc/world/flat/SimpleChunkSection.java diff --git a/flat_world/src/main/java/mc/world/flat/SimpleChunkSection.java b/flat_world/src/main/java/mc/world/flat/SimpleChunkSection.java new file mode 100644 index 0000000..1355c18 --- /dev/null +++ b/flat_world/src/main/java/mc/world/flat/SimpleChunkSection.java @@ -0,0 +1,119 @@ +/* + * DmitriyMX + * 2018-04-28 + */ +package mc.world.flat; + +import mc.core.block.Block; +import mc.core.block.BlockFactory; +import mc.core.block.BlockType; +import mc.core.world.Biome; +import mc.core.world.ChunkSection; +import mc.core.world.Region; +import mc.core.world.World; + +public class SimpleChunkSection implements ChunkSection { + @Override + public int getBlockType(int x, int y, int z) { + if (y == 0) return 7; + else if (y >= 1 && y <= 2) return 3; + else if (y == 3) return 2; + else return 0; + } + + @Override + public void setBlockType(int x, int y, int z, int type) { + + } + + @Override + public int getBlockMetadata(int x, int y, int z) { + return 0; + } + + @Override + public void setBlockMetadata(int x, int y, int z, int metadata) { + + } + + @Override + public int getBlockLight(int x, int y, int z) { + return 0; + } + + @Override + public void setBlockLight(int x, int y, int z, int lightLevel) { + + } + + @Override + public int getSkyLight(int x, int y, int z) { + if (y <= 3) return 0; + else return 15; + } + + @Override + public void setSkyLight(int x, int y, int z, int lightLevel) { + + } + + @Override + public int getAddition(int x, int y, int z) { + return 0; + } + + @Override + public void setAddition(int x, int y, int z, int value) { + + } + + @Override + public Biome getBiome(int x, int z) { + return Biome.PLAINS; + } + + @Override + public void setBiome(int x, int z, Biome biome) { + + } + + @Override + public int getX() { + return 0; + } + + @Override + public int getY() { + return 0; + } + + @Override + public int getZ() { + return 0; + } + + @Override + public void setBlock(int x, int y, int z, Block block) { + + } + + @Override + public Block getBlock(int x, int y, int z) { + BlockFactory blockFactory = new BlockFactory(); + + if (y == 0) return blockFactory.create(BlockType.BEDROCK, 0); + else if (y >= 1 && y <= 2) return blockFactory.create(BlockType.DIRT, 0); + else if (y == 3) return blockFactory.create(BlockType.GRASS, 0); + else return Block.airBlock(x, y, z); + } + + @Override + public Region getRegion() { + return null; + } + + @Override + public World getWorld() { + return null; + } +}