Package mindustry.world
Class Tiles
java.lang.Object
mindustry.world.Tiles
A tile container.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
fill()
fills this tile set with empty air tiles.get
(int x, int y) getc
(int x, int y) geti
(int idx) getn
(int x, int y) getp
(int pos) boolean
in
(int x, int y) iterator()
void
set a tile at a position; does not range-check.void
set a tile at a raw array position; used for fast iteration / 1-D for-loopsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
width
public final int width -
height
public final int height
-
-
Constructor Details
-
Tiles
public Tiles(int width, int height)
-
-
Method Details
-
each
-
fill
public void fill()fills this tile set with empty air tiles. -
set
set a tile at a position; does not range-check. use with caution. -
seti
set a tile at a raw array position; used for fast iteration / 1-D for-loops -
in
public boolean in(int x, int y) - Returns:
- whether these coordinates are in bounds
-
get
- Returns:
- a tile at coordinates, or null if out of bounds
-
getn
- Returns:
- a tile at coordinates; throws an exception if out of bounds
-
getc
- Returns:
- a tile at coordinates, clamped.
-
geti
- Returns:
- a tile at an iteration index [0, width * height]
-
getp
- Returns:
- a tile at an int position (not equivalent to geti)
-
eachTile
-
iterator
-