Archived
0

Merge branch 'proto_1.12.2' into develop

Tests: FAILED
This commit is contained in:
2018-08-07 10:03:46 +03:00
12 changed files with 255 additions and 86 deletions

View File

@@ -4,44 +4,33 @@
*/
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.Chunk;
import mc.core.world.block.Block;
import mc.core.world.block.BlockFactory;
import mc.core.world.chunk.Chunk;
import static mc.core.world.block.BlockType.*;
public class SimpleChunk implements Chunk {
@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;
private static BlockFactory blockFactory = new BlockFactory();
private final int x, y, z;
public SimpleChunk(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
@Override
public void setBlockType(int x, int y, int z, int type) {
public Block getBlock(int x, int y, int z) {
if (y == 0) return blockFactory.create(BEDROCK);
else if (y >= 1 && y <= 2) return blockFactory.create(DIRT);
else if (y == 3) return blockFactory.create(GRASS);
else return blockFactory.create(AIR);
}
@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) {
public void setBlock(Block block) {
}
@Override
@@ -77,31 +66,16 @@ public class SimpleChunk implements Chunk {
@Override
public int getX() {
return 0;
return x;
}
@Override
public int getY() {
return 0;
return y;
}
@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);
return z;
}
}