Package mindustry.world
Class Tile
java.lang.Object
mindustry.world.Tile
- All Implemented Interfaces:
arc.math.geom.Position
,arc.math.geom.QuadTree.QuadTreeObject
,Displayable
- Direct Known Subclasses:
CachedTile
,EditorTile
public class Tile
extends Object
implements arc.math.geom.Position, arc.math.geom.QuadTree.QuadTreeObject, Displayable
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte
absoluteRelativeTo
(int cx, int cy) boolean
adjacentTo
(Tile tile) int
array()
block()
short
blockID()
boolean
static void
buildDestroyed
(mindustry.gen.Building build) static void
buildHealthUpdate
(arc.struct.IntSeq buildings) <T extends Block>
Tcblock()
int
centerX()
int
centerY()
protected void
changeBuild
(Team team, arc.func.Prov<mindustry.gen.Building> entityprov, int rotation) protected void
changed()
void
void
circle
(int radius, arc.func.Intc2 cons) void
boolean
void
display
(arc.scene.ui.layout.Table table) float
drawx()
float
drawy()
drop()
protected void
protected void
floor()
short
floorID()
arc.math.geom.Rect
getBounds
(arc.math.geom.Rect rect) float
Returns the flammability of the tile.arc.math.geom.Rect
getHitbox
(arc.math.geom.Rect rect) void
getLinkedTiles
(arc.func.Cons<Tile> cons) Iterates through the list of all tiles linked to this multiblock, or just itself if it's not a multiblock.arc.struct.Seq<Tile>
getLinkedTiles
(arc.struct.Seq<Tile> tmpArray) Returns the list of all tiles linked to this multiblock.void
getLinkedTilesAs
(Block block, arc.func.Cons<Tile> tmpArray) Returns the list of all tiles linked to this multiblock if it were this block.arc.struct.Seq<Tile>
getLinkedTilesAs
(Block block, arc.struct.Seq<Tile> tmpArray) Returns the list of all tiles linked to this multiblock if it were this block.int
float
getX()
float
getY()
void
hitbox
(arc.math.geom.Rect rect) boolean
interactable
(Team team) boolean
isCenter()
boolean
boolean
boolean
legSolid()
nearby
(int rotation) nearby
(int dx, int dy) nearby
(arc.math.geom.Point2 relative) mindustry.gen.Building
nearbyBuild
(int rotation) overlay()
short
boolean
passable()
int
pos()
Returns this tile's position as a packed point.protected void
void
recache()
void
static int
relativeTo
(float x, float y, float cx, float cy) byte
relativeTo
(int cx, int cy) Return relative rotation to a coordinate.static byte
relativeTo
(int x, int y, int cx, int cy) byte
relativeTo
(Tile tile) void
remove()
void
remove()-s this tile, except it's synced across the networkstatic void
removeTile
(Tile tile) void
setAir()
Sets the block to air.void
void
void
void
void
This resets the overlay!static void
void
setFloorNet
(Block floor) set()-s this tile, except it's synced across the networkvoid
setFloorNet
(Block floor, Block overlay) set()-s this tile, except it's synced across the networkvoid
setFloorUnder
(Floor floor) Sets the floor, preserving overlay.void
set()-s this tile, except it's synced across the networkvoid
set()-s this tile, except it's synced across the networkvoid
setOverlay
(Block block) static void
setOverlay
(Tile tile, Block overlay) void
setOverlayID
(short ore) void
setOverlayNet
(Block overlay) set()-s this tile, except it's synced across the networkvoid
setOverlayQuiet
(Block block) Sets the overlay without a recache.void
Do not call unless you know what you are doing! This does not update the indexer!static void
static void
static void
static void
setTileBlocks
(Block block, Team team, int[] positions) Positions are in 'packed position' format - left bits x, right bits y.static void
setTileFloors
(Block block, int[] positions) Positions are in 'packed position' format - left bits x, right bits y.static void
setTileOverlays
(Block block, int[] positions) Positions are in 'packed position' format - left bits x, right bits y.boolean
solid()
int
boolean
Whether this block was placed by a player/unit.team()
toString()
wallDrop()
float
worldx()
float
worldy()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface mindustry.ui.Displayable
displayable
Methods inherited from interface arc.math.geom.Position
angleTo, angleTo, dst, dst, dst2, dst2, within, within
-
Field Details
-
data
public byte dataExtra data for very specific blocks. -
build
@Nullable public mindustry.gen.Building buildTile entity, usually null. -
x
public short x -
y
public short y -
block
-
floor
-
overlay
-
changing
protected boolean changing
-
-
Constructor Details
-
Tile
public Tile(int x, int y) -
Tile
-
Tile
public Tile(int x, int y, int floor, int overlay, int wall)
-
-
Method Details
-
pos
public int pos()Returns this tile's position as a packed point. -
array
public int array()- Returns:
- this tile's position, packed to the world width - for use in width*height arrays.
-
relativeTo
-
relativeTo
public byte relativeTo(int cx, int cy) Return relative rotation to a coordinate. Returns -1 if the coordinate is not near this tile. -
relativeTo
public static byte relativeTo(int x, int y, int cx, int cy) -
relativeTo
public static int relativeTo(float x, float y, float cx, float cy) -
absoluteRelativeTo
public byte absoluteRelativeTo(int cx, int cy) -
getFlammability
public float getFlammability()Returns the flammability of the tile. Used for fire calculations. Takes flammability of floor liquid into account. -
worldx
public float worldx() -
worldy
public float worldy() -
drawx
public float drawx() -
drawy
public float drawy() -
isDarkened
public boolean isDarkened() -
floor
-
block
-
overlay
-
cblock
-
team
-
setTeam
Do not call unless you know what you are doing! This does not update the indexer! -
isCenter
public boolean isCenter() -
centerX
public int centerX() -
centerY
public int centerY() -
getTeamID
public int getTeamID() -
setBlock
-
setBlock
-
setBlock
-
setBlock
-
setFloor
This resets the overlay! -
isEditorTile
public boolean isEditorTile() -
setFloorUnder
Sets the floor, preserving overlay. -
setAir
public void setAir()Sets the block to air. -
circle
public void circle(int radius, arc.func.Intc2 cons) -
circle
-
recacheWall
public void recacheWall() -
recache
public void recache() -
remove
public void remove() -
removeNet
public void removeNet()remove()-s this tile, except it's synced across the network -
setNet
set()-s this tile, except it's synced across the network -
setNet
set()-s this tile, except it's synced across the network -
setFloorNet
set()-s this tile, except it's synced across the network -
setFloorNet
set()-s this tile, except it's synced across the network -
setOverlayNet
set()-s this tile, except it's synced across the network -
overlayID
public short overlayID() -
blockID
public short blockID() -
floorID
public short floorID() -
setOverlayID
public void setOverlayID(short ore) -
setOverlay
-
setOverlayQuiet
Sets the overlay without a recache. -
clearOverlay
public void clearOverlay() -
passable
public boolean passable() -
synthetic
public boolean synthetic()Whether this block was placed by a player/unit. -
solid
public boolean solid() -
breakable
public boolean breakable() -
dangerous
public boolean dangerous()- Returns:
- whether the floor on this tile deals damage or can be drowned on.
-
getLinkedTiles
Iterates through the list of all tiles linked to this multiblock, or just itself if it's not a multiblock. The result contains all linked tiles, including this tile itself. -
getLinkedTiles
Returns the list of all tiles linked to this multiblock. This array contains all linked tiles, including this tile itself. -
getLinkedTilesAs
Returns the list of all tiles linked to this multiblock if it were this block. The result contains all linked tiles, including this tile itself. -
getLinkedTilesAs
Returns the list of all tiles linked to this multiblock if it were this block. The result contains all linked tiles, including this tile itself. -
getHitbox
public arc.math.geom.Rect getHitbox(arc.math.geom.Rect rect) -
getBounds
public arc.math.geom.Rect getBounds(arc.math.geom.Rect rect) -
hitbox
public void hitbox(arc.math.geom.Rect rect) - Specified by:
hitbox
in interfacearc.math.geom.QuadTree.QuadTreeObject
-
nearby
-
nearby
-
nearby
-
nearbyBuild
@Nullable public mindustry.gen.Building nearbyBuild(int rotation) -
interactable
-
drop
-
wallDrop
-
staticDarkness
public int staticDarkness() -
legSolid
public boolean legSolid()- Returns:
- whether this tile is solid for legged units
-
adjacentTo
- Returns:
- true if these tiles are right next to each other.
-
preChanged
protected void preChanged() -
changeBuild
protected void changeBuild(Team team, arc.func.Prov<mindustry.gen.Building> entityprov, int rotation) -
changed
protected void changed() -
fireChanged
protected void fireChanged() -
firePreChanged
protected void firePreChanged() -
display
public void display(arc.scene.ui.layout.Table table) - Specified by:
display
in interfaceDisplayable
-
getX
public float getX()- Specified by:
getX
in interfacearc.math.geom.Position
-
getY
public float getY()- Specified by:
getY
in interfacearc.math.geom.Position
-
toString
-
setTileBlocks
Positions are in 'packed position' format - left bits x, right bits y. -
setTileFloors
Positions are in 'packed position' format - left bits x, right bits y. -
setTileOverlays
Positions are in 'packed position' format - left bits x, right bits y. -
setFloor
-
setOverlay
-
removeTile
-
setTile
-
setTeam
-
setTeams
-
buildDestroyed
public static void buildDestroyed(mindustry.gen.Building build) -
buildHealthUpdate
public static void buildHealthUpdate(arc.struct.IntSeq buildings)
-