public class ChunkMap extends AbstractMap implements java.lang.Cloneable
Constructor and Description |
---|
ChunkMap(java.io.File name,
Generator generator,
int saveslot)
Loads a map.
|
ChunkMap(java.io.File name,
int saveslot)
Loads a map using the default generator.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose() |
CoreData |
getBlock(Coordinate coord) |
CoreData |
getBlock(int x,
int y,
int z)
Returns a block without checking the parameters first.
|
int |
getBlocksX()
Returns the amount of Blocks inside the map in x-direction.
|
int |
getBlocksY()
Returns the amount of Blocks inside the map in y-direction.
|
int |
getBlocksZ()
Returns the amount of Blocks inside the map in z-direction.
|
Chunk |
getChunk(Coordinate coord)
get the chunk where the coordinates are on
|
Chunk |
getChunk(int chunkX,
int chunkY)
get the chunk with the given chunk coords.
|
java.util.ArrayList<Chunk> |
getData()
Get the data of the map
|
java.util.ArrayList<AbstractEntity> |
getEntitysOnChunk(int xChunk,
int yChunk)
Get every entity on a chunk.
|
java.util.ArrayList<AbstractEntity> |
getEntitysOnChunkWhichShouldBeSaved(int xChunk,
int yChunk)
Get every entity on a chunk which should be saved
|
void |
loadChunk(int chunkX,
int chunkY)
loads a chunk from disk
|
void |
postUpdate(float dt)
Called after the view update to catch changes caused by the view
|
void |
print()
prints the map to console
|
boolean |
save(int saveSlot)
saves every chunk on the map
|
void |
setBlock(Coordinate coord,
CoreData block)
Replace a block.
|
void |
setBlock(RenderBlock block)
Replace a block.
|
void |
update(float dt) |
addLinkedObject, clone, createSaveSlot, createSaveSlot, getCenter, getCenter, getCurrentSaveSlot, getCVars, getDefaultGenerator, getEntitys, getEntitys, getEntitysOnCoord, getEntitysOnCoord, getGameDepth, getGameHeight, getGameSpeed, getGameWidth, getGenerator, getGroundBlock, getIterator, getLinkedObjects, getPath, getSaveCVars, getSavesCount, getSavesCount, getWorldSpinDirection, hasSaveSlot, isModified, modificationCheck, modified, newSaveSlot, newSaveSlot, newSaveSlot, onModified, setCustomMapCVarRegistration, setCVarSystem, setDefaultGenerator, setGameSpeed, setGenerator, useSaveSlot
public ChunkMap(java.io.File name, int saveslot) throws java.io.IOException
name
- if available on disk it will be loadsaveslot
- java.io.IOException
public ChunkMap(java.io.File name, Generator generator, int saveslot) throws java.io.IOException
name
- if available on disk it will load the meta filegenerator
- the generator used for generating new chunkssaveslot
- java.io.IOException
- thrown if there is no full read/write access to the map filepublic void update(float dt)
update
in class AbstractMap
dt
- public void postUpdate(float dt)
postUpdate
in class AbstractMap
dt
- public void loadChunk(int chunkX, int chunkY)
chunkX
- chunkY
- public java.util.ArrayList<Chunk> getData()
public CoreData getBlock(int x, int y, int z)
getBlock
in class AbstractMap
x
- coordinatey
- coordinatez
- coordinatepublic CoreData getBlock(Coordinate coord)
getBlock
in class AbstractMap
coord
- public void setBlock(RenderBlock block)
AbstractMap
setBlock
in class AbstractMap
block
- no null pointerAbstractMap.setBlock(com.BombingGames.WurfelEngine.Core.Gameobjects.RenderBlock)
public void setBlock(Coordinate coord, CoreData block)
AbstractMap
setBlock
in class AbstractMap
AbstractMap.setBlock(com.BombingGames.WurfelEngine.Core.Gameobjects.RenderBlock)
public Chunk getChunk(Coordinate coord)
coord
- public Chunk getChunk(int chunkX, int chunkY)
chunkX
- chunkY
- public java.util.ArrayList<AbstractEntity> getEntitysOnChunk(int xChunk, int yChunk)
xChunk
- yChunk
- public java.util.ArrayList<AbstractEntity> getEntitysOnChunkWhichShouldBeSaved(int xChunk, int yChunk)
xChunk
- yChunk
- public boolean save(int saveSlot)
save
in class AbstractMap
public void print()
print
in class AbstractMap
public void dispose()
dispose
in class AbstractMap
public int getBlocksX()
getBlocksX
in class AbstractMap
public int getBlocksY()
getBlocksY
in class AbstractMap
public int getBlocksZ()
getBlocksZ
in class AbstractMap