public abstract class AbstractMap
extends java.lang.Object
implements java.lang.Cloneable
Constructor and Description |
---|
AbstractMap(java.io.File directory,
Generator generator,
int saveSlot) |
Modifier and Type | Method and Description |
---|---|
void |
addLinkedObject(LinkedWithMap object) |
AbstractMap |
clone()
Clones the map.
|
static void |
createSaveSlot(java.io.File path,
int slot) |
void |
createSaveSlot(int slot) |
void |
dispose() |
abstract CoreData |
getBlock(Coordinate coord) |
abstract CoreData |
getBlock(int x,
int y,
int z)
Returns a block without checking the parameters first.
|
abstract int |
getBlocksX()
Returns the amount of Blocks inside the map in x-direction.
|
abstract int |
getBlocksY()
Returns the amount of Blocks inside the map in y-direction.
|
abstract int |
getBlocksZ()
Returns the amount of Blocks inside the map in z-direction.
|
Point |
getCenter()
Returns a coordinate pointing to the absolute center of the map.
|
Point |
getCenter(float height)
Returns a coordinate pointing to middle of a 3x3 chunk map.
|
int |
getCurrentSaveSlot() |
CVarSystem |
getCVars()
in regular case only read operations should be performed on the cvars in here
|
static Generator |
getDefaultGenerator()
Get the default set generator.
|
java.util.ArrayList<AbstractEntity> |
getEntitys()
Returns the entityList
|
<type extends AbstractEntity> |
getEntitys(java.lang.Class<type> type)
Find every instance of a special class.
|
java.util.ArrayList<AbstractEntity> |
getEntitysOnCoord(Coordinate coord)
Get every entity on a coord.
|
<type> java.util.ArrayList<type> |
getEntitysOnCoord(Coordinate coord,
java.lang.Class<? extends AbstractEntity> type)
Get every entity on a coord of the wanted type
|
int |
getGameDepth()
The depth of the map in game size
|
int |
getGameHeight()
Game size
|
float |
getGameSpeed() |
int |
getGameWidth()
The width of the map with three chunks in use
|
Generator |
getGenerator() |
CoreData |
getGroundBlock() |
MemoryMapIterator |
getIterator(int startLimit,
int topLimitZ)
Get an iteration which can loop throug the map
|
java.util.ArrayList<LinkedWithMap> |
getLinkedObjects() |
java.io.File |
getPath()
The name of the map on the file.
|
CVarSystem |
getSaveCVars()
save dependant Cvars.
|
int |
getSavesCount()
checks a map for the amount of save files
|
static int |
getSavesCount(java.io.File path) |
int |
getWorldSpinDirection()
Returns the degree of the world spin.
|
boolean |
hasSaveSlot(int saveSlot)
Check if a save slot exists.
|
boolean |
isModified()
True if some block has changed in loaded chunks.
|
void |
modificationCheck()
should be executed after the update method
|
void |
modified()
set the modified flag to true. usually not manually called.
|
int |
newSaveSlot()
Uses a new save slot as the save slot
|
static int |
newSaveSlot(java.io.File path) |
void |
newSaveSlot(int slot) |
protected void |
onModified()
called when the map is modified
|
abstract void |
postUpdate(float dt)
Called after the view update to catch changes caused by the view
|
abstract void |
print()
prints the map to console
|
abstract boolean |
save(int saveSlot)
saves every chunk on the map
|
abstract void |
setBlock(Coordinate coord,
CoreData block)
Replace a block.
|
abstract void |
setBlock(RenderBlock block)
Replace a block.
|
static void |
setCustomMapCVarRegistration(CustomMapCVarRegistration mapcvars)
Set a custom registration of cvars before they are loaded.
|
void |
setCVarSystem(CVarSystem cvarSystem)
should be set if you want to have custom.
|
static void |
setDefaultGenerator(Generator generator) |
void |
setGameSpeed(float gameSpeed)
Set the speed of the world.
|
void |
setGenerator(Generator generator)
Set the generator used for generating maps
|
void |
update(float dt) |
void |
useSaveSlot(int slot)
uses a specific save slot for loading and saving the map
|
public AbstractMap(java.io.File directory, Generator generator, int saveSlot) throws java.io.IOException
directory
- the directory where the map lays ingenerator
- saveSlot
- the used saveslotjava.io.IOException
public static void setDefaultGenerator(Generator generator)
generator
- public static Generator getDefaultGenerator()
setDefaultGenerator(Generator)
public static int newSaveSlot(java.io.File path)
path
- the directory of the mappublic static void createSaveSlot(java.io.File path, int slot)
path
- the directory of the mapslot
- public static int getSavesCount(java.io.File path)
public static void setCustomMapCVarRegistration(CustomMapCVarRegistration mapcvars)
mapcvars
- public void setCVarSystem(CVarSystem cvarSystem)
cvarSystem
- public int getWorldSpinDirection()
public void addLinkedObject(LinkedWithMap object)
object
- public Point getCenter()
public Point getCenter(float height)
height
- You custom height.public java.util.ArrayList<AbstractEntity> getEntitys()
public int getGameWidth()
public int getGameDepth()
public int getGameHeight()
public <type extends AbstractEntity> java.util.ArrayList<type> getEntitys(java.lang.Class<type> type)
type
- type
- public java.util.ArrayList<AbstractEntity> getEntitysOnCoord(Coordinate coord)
coord
- public <type> java.util.ArrayList<type> getEntitysOnCoord(Coordinate coord, java.lang.Class<? extends AbstractEntity> type)
type
- the class you want to filter.coord
- the coord where you want to get every entity fromtype
- the class you want to filter.public boolean isModified()
public abstract CoreData getBlock(Coordinate coord)
coord
- public abstract CoreData getBlock(int x, int y, int z)
x
- coordinatey
- coordinatez
- coordinatepublic CoreData getGroundBlock()
public java.util.ArrayList<LinkedWithMap> getLinkedObjects()
public MemoryMapIterator getIterator(int startLimit, int topLimitZ)
startLimit
- the starting leveltopLimitZ
- the top limit of the iterationsprotected void onModified()
public void modified()
public float getGameSpeed()
public abstract boolean save(int saveSlot)
saveSlot
- public abstract void setBlock(RenderBlock block)
block
- no null pointersetBlock(com.BombingGames.WurfelEngine.Core.Gameobjects.RenderBlock)
public abstract void setBlock(Coordinate coord, CoreData block)
coord
- block
- setBlock(com.BombingGames.WurfelEngine.Core.Gameobjects.RenderBlock)
public void setGameSpeed(float gameSpeed)
gameSpeed
- public void setGenerator(Generator generator)
generator
- public void dispose()
public java.io.File getPath()
public abstract int getBlocksX()
public abstract int getBlocksY()
public abstract int getBlocksZ()
public abstract void print()
public abstract void postUpdate(float dt)
dt
- public AbstractMap clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public void update(float dt)
dt
- public void modificationCheck()
public Generator getGenerator()
public int getCurrentSaveSlot()
public void useSaveSlot(int slot)
slot
- public int newSaveSlot()
public void newSaveSlot(int slot)
public boolean hasSaveSlot(int saveSlot)
saveSlot
- public void createSaveSlot(int slot)
public int getSavesCount()
public CVarSystem getCVars()
public CVarSystem getSaveCVars()