public class Map
extends java.lang.Object
implements java.lang.Cloneable
Constructor and Description |
---|
Map(java.lang.String name)
Creates an empty map.
|
Map(java.lang.String name,
Generator generator)
Creates an empty map.
|
Modifier and Type | Method and Description |
---|---|
Map |
clone()
Clones the map.
|
void |
earthquake(int numberofblocks)
a method who gives random blocks offset
|
void |
fill()
If no custom generor set will use air.
|
void |
fill(Generator generator) |
void |
fillWithAir()
Fill the data array of the map with Cells.
|
<type extends AbstractEntity> |
getAllEntitysOfType(java.lang.Class<? extends AbstractEntity> type)
Find every instance of a special class e.g. find every AbstractCharacter
|
java.util.ArrayList<AbstractEntity> |
getAllEntitysOnCoord(Coordinate coord)
Get every entity on a coord.
|
<type> java.util.ArrayList<type> |
getAllEntitysOnCoord(Coordinate coord,
java.lang.Class<? extends AbstractEntity> type)
Get every entity on a coord of the wanted type
|
Block |
getBlock(Coordinate coord) |
Block |
getBlock(int x,
int y,
int z)
Returns a Block without checking the parameters first.
|
Block |
getBlockClamp(int x,
int y,
int z)
Returns a block of the map.
|
static int |
getBlocksX()
Returns the amount of Blocks inside the map in x-direction.
|
static int |
getBlocksY()
Returns the amount of Blocks inside the map in y-direction.
|
static int |
getBlocksZ()
Returns the amount of Blocks inside the map in z-direction.
|
int[] |
getCellOffset(Coordinate coord) |
static Point |
getCenter()
Returns a coordinate pointing to the absolute center of the map.
|
static Point |
getCenter(float height)
Returns a corodinate pointing to the absolute center of the map.
|
int[] |
getChunkCoords(int pos)
Get the coordinates of a chunk.
|
Cell[][][] |
getData()
Get the data of the map
|
Block |
getDataClamp(Coordinate coords)
Get a block at a coordinate but clamp it first.
|
java.util.ArrayList<AbstractEntity> |
getEntitys()
Returns the entityList
|
static int |
getGameDepth()
The depth of the map in game size
|
static int |
getGameHeight()
Game size
|
static int |
getGameWidth()
The width of the map with three chunks in use
|
int |
getWorldSpinDirection()
Returns the degree of the world spin.
|
void |
setCelloffset(Coordinate coord,
int field,
int value)
Set the offset in one cell.
|
void |
setCenter(int newmiddle)
Reorganises the map and sets the new middle chunk to param newmiddle.
|
void |
setData(Coordinate coords,
Block block)
Set a block at a specific coordinate.
|
void |
setData(int x,
int y,
int z,
Block block)
Set a block at a specific coordinate.
|
void |
setDataSafe(Coordinate coord,
Block block)
Set a block with safety checks.
|
void |
setDataSafe(int[] coords,
Block block)
Set a block with safety checks.
|
void |
setGenerator(Generator generator) |
static void |
staticDispose() |
public Map(java.lang.String name)
name
- if available on disk it will be loadfill(com.BombingGames.WurfelEngine.Core.Map.Generator)
public Map(java.lang.String name, Generator generator)
name
- if available on disk it will be loadgenerator
- fill(com.BombingGames.WurfelEngine.Core.Map.Generator)
public void fill()
public void fill(Generator generator)
generator
- public void fillWithAir()
public static int getBlocksX()
public static int getBlocksY()
public static int getBlocksZ()
public Cell[][][] getData()
public void setCenter(int newmiddle)
newmiddle
- newmiddle is 1, 3, 5 or 7public int[] getChunkCoords(int pos)
pos
- public Block getBlock(int x, int y, int z)
x
- positiony
- positionz
- positionpublic Block getBlock(Coordinate coord)
coord
- public Block getBlockClamp(int x, int y, int z)
x
- If too high or too low, it takes the highest/deepest value possibley
- If too high or too low, it takes the highest/deepest value possiblez
- If too high or too low, it takes the highest/deepest value possiblegetDataClamp(com.BombingGames.WurfelEngine.Core.Map.Coordinate)
public Block getDataClamp(Coordinate coords)
coords
- public void setData(int x, int y, int z, Block block)
x
- positiony
- positionz
- positionblock
- public void setData(Coordinate coords, Block block)
coords
- block
- public void setDataSafe(int[] coords, Block block)
coords
- block
- public void setDataSafe(Coordinate coord, Block block)
coord
- block
- public void setGenerator(Generator generator)
generator
- public void earthquake(int numberofblocks)
numberofblocks
- the amount of moved blockspublic java.util.ArrayList<AbstractEntity> getEntitys()
public int getWorldSpinDirection()
public int[] getCellOffset(Coordinate coord)
coord
- public void setCelloffset(Coordinate coord, int field, int value)
coord
- the cellfield
- 0 = X, 1 = y, 2 = zvalue
- the value you want to set the fieldpublic <type extends AbstractEntity> java.util.ArrayList<type> getAllEntitysOfType(java.lang.Class<? extends AbstractEntity> type)
type
- type
- public java.util.ArrayList<AbstractEntity> getAllEntitysOnCoord(Coordinate coord)
coord
- public <type> java.util.ArrayList<type> getAllEntitysOnCoord(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 static Point getCenter()
public static Point getCenter(float height)
height
- You custom height.public static int getGameWidth()
public static int getGameDepth()
public static int getGameHeight()
public Map clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public static void staticDispose()