public class Chunk
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
CHUNKFILESUFFIX
The suffix of a chunk files.
|
protected static java.lang.String |
METAFILESUFFIX
The suffix of the metafile
|
Constructor and Description |
---|
Chunk()
Creates a Chunk filled with empty cells (likely air).
|
Chunk(int coordX,
int coordY,
Generator generator)
Creates a chunk by generating a new one.
|
Chunk(java.lang.String mapname,
int coordX,
int coordY,
Generator generator)
Creates a chunk by trying to load and if this fails it generates a new one.
|
Modifier and Type | Method and Description |
---|---|
static int |
getBlocksX()
The amount of blocks in X direction
|
static int |
getBlocksY()
The amount of blocks in Y direction
|
static int |
getBlocksZ()
The amount of blocks in Z direction
|
Block[][][] |
getData()
Returns the data of the chunk
|
static int |
getGameDepth() |
static int |
getGameHeight()
The height of the map.
|
static int |
getGameWidth() |
static int |
getScreenDepth() |
static int |
getScreenWidth() |
void |
print()
print the chunk to console
|
boolean |
save(java.lang.String fileName,
int pos) |
void |
setData(Block[][][] data) |
protected static void |
setDimensions(MapMetaData meta) |
protected static final java.lang.String CHUNKFILESUFFIX
protected static final java.lang.String METAFILESUFFIX
public Chunk()
public Chunk(java.lang.String mapname, int coordX, int coordY, Generator generator)
coordX
- the chunk coordinatecoordY
- the chunk coordinatemapname
- filenamegenerator
- public Chunk(int coordX, int coordY, Generator generator)
coordX
- the chunk coordinatecoordY
- the chunk coordinategenerator
- protected static void setDimensions(MapMetaData meta)
meta
- public boolean save(java.lang.String fileName, int pos) throws java.io.IOException
fileName
- the map name on diskpos
- position on map in memoryjava.io.IOException
public static int getBlocksX()
public static int getBlocksY()
public static int getBlocksZ()
public Block[][][] getData()
public void setData(Block[][][] data)
data
- public static int getScreenWidth()
public static int getScreenDepth()
public static int getGameWidth()
public static int getGameDepth()
public static int getGameHeight()
public void print()