Archived
0

Chunk changes

This commit is contained in:
Forwolk
2018-07-27 08:17:19 +03:00
parent ec67dc328e
commit bf2352c747
4 changed files with 63 additions and 5 deletions

View File

@@ -4,6 +4,27 @@
*/
package mc.core.world;
import mc.core.block.Block;
/**
* Serialization chunk info
*
* +-------------+----------------+------------+
* | param | range | bits |
* +-------------+----------------+------------+
* | biomeMap | 16x16 0-16 | 4096 |
* +-------------+----------------+------------+
* | | | 3 |
* +-------------+----------------+------------+
* | block_count | 0:4096 | 13 |
* +-------------+----------------+------------+
* | blocks | array | 24*count |
* +-------------+----------------+------------+
*
* Total: 4112 bits header (514 bytes) + 24 * block_count bits (3 * block_count bytes)
* Max size: 12802 bytes (~13 Mb per chunk)
*
*/
/* 16x16x16 */
public interface Chunk {
int getBlockType(int x, int y, int z);
@@ -21,6 +42,13 @@ public interface Chunk {
int getAddition(int x, int y, int z);
void setAddition(int x, int y, int z, int value);
int getBiome(int x, int z);
void setBiome(int x, int z, int value);
Biome getBiome(int x, int z);
void setBiome(int x, int z, Biome biome);
int getX();
int getY();
int getZ();
Block[] getNotAirBlocks();
void setBlock (int x, int y, int z, Block block);
}

View File

@@ -17,7 +17,7 @@ import java.util.UUID;
public class FlatWorld implements World {
@Getter@Setter
private UUID worldId;
private UUID worldId = UUID.fromString("00000000-0000-0000-C000-000000000046");
@Getter
@Setter

View File

@@ -4,6 +4,8 @@
*/
package mc.world.flat;
import mc.core.block.Block;
import mc.core.world.Biome;
import mc.core.world.Chunk;
public class SimpleChunk implements Chunk {
@@ -62,12 +64,37 @@ public class SimpleChunk implements Chunk {
}
@Override
public int getBiome(int x, int z) {
public Biome getBiome(int x, int z) {
return Biome.PLAIN;
}
@Override
public void setBiome(int x, int z, Biome biome) {
}
@Override
public int getX() {
return 0;
}
@Override
public void setBiome(int x, int z, int value) {
public int getY() {
return 0;
}
@Override
public int getZ() {
return 0;
}
@Override
public Block[] getNotAirBlocks() {
return new Block[0];
}
@Override
public void setBlock(int x, int y, int z, Block block) {
}
}

View File

@@ -0,0 +1,3 @@
### System properties:
* `worlds.folder` -- folder where worlds will be located