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.
|
Constructor and Description |
---|
Chunk(ChunkMap map,
java.io.File path,
int coordX,
int coordY,
Generator generator)
Creates a chunk by trying to load and if this fails it generates a new one.
|
Chunk(ChunkMap map,
int coordX,
int coordY)
Creates a Chunk filled with empty cells (likely air).
|
Chunk(ChunkMap map,
int coordX,
int coordY,
Generator generator)
Creates a chunk by generating a new one.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose(java.io.File path)
disposes the chunk
|
CoreData |
getBlock(int x,
int y,
int z) |
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
|
int |
getChunkX()
Get the chunk coordinate of this chunk.
|
int |
getChunkY()
Get the chunk coordinate of this chunk.
|
CoreData[][][] |
getData()
Returns the data of the chunk
|
static int |
getGameDepth()
y axis
|
static int |
getGameHeight()
The height of the map. z axis
|
static int |
getGameWidth()
x axis
|
DataIterator |
getIterator(int startingZ,
int limitZ) |
Coordinate |
getTopLeftCoordinate() |
static int |
getViewDepth()
Not scaled.
|
static int |
getViewWidth()
Not scaled.
|
boolean |
hasCoord(Coordinate coord)
Check if the coordinate has the coordinate inside.
|
boolean |
hasPoint(Point point)
Check if the coordinate has the coordinate inside.
|
void |
increaseCameraHandleCounter() |
void |
processModification() |
void |
resetCameraAccesCounter()
Set that no camera is accessing this chunk.
|
boolean |
save(java.io.File path,
int saveSlot) |
void |
setBlock(Coordinate coord,
CoreData block) |
void |
setBlock(RenderBlock block)
sets a block in the map. if position is under the map does nothing.
|
java.lang.String |
toString()
print the chunk to console
|
void |
update(float dt) |
protected static final java.lang.String CHUNKFILESUFFIX
public Chunk(ChunkMap map, int coordX, int coordY)
map
- coordX
- coordY
- public Chunk(ChunkMap map, java.io.File path, int coordX, int coordY, Generator generator)
map
- coordX
- the chunk coordinatecoordY
- the chunk coordinatepath
- filenamegenerator
- public void update(float dt)
dt
- public void processModification()
public boolean save(java.io.File path, int saveSlot) throws java.io.IOException
path
- the map name on disksaveSlot
- java.io.IOException
public static int getBlocksX()
public static int getBlocksY()
public static int getBlocksZ()
public CoreData[][][] getData()
public static int getViewWidth()
public static int getViewDepth()
public static int getGameWidth()
public static int getGameDepth()
public static int getGameHeight()
public boolean hasCoord(Coordinate coord)
coord
- the coordinate to be checkedpublic boolean hasPoint(Point point)
point
- the coordinate to be checkedpublic java.lang.String toString()
toString
in class java.lang.Object
public DataIterator getIterator(int startingZ, int limitZ)
startingZ
- limitZ
- public int getChunkX()
public int getChunkY()
public Coordinate getTopLeftCoordinate()
public CoreData getBlock(int x, int y, int z)
x
- coordinatey
- coordinatez
- coordinatepublic void setBlock(RenderBlock block)
block
- no null pointer allowedpublic void setBlock(Coordinate coord, CoreData block)
coord
- block
- public void resetCameraAccesCounter()
public final void increaseCameraHandleCounter()
public void dispose(java.io.File path)
path
- if null, does not save the file