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
FieldsModifier and TypeFieldDescriptionprotected Blockmindustry.gen.BuildingTile entity, usually null.protected booleanbyteExtra data for specific blocks.intEven more data for blocks.protected FloorbyteExtra data for specific blocks.protected FloorbyteExtra data for specific blocks.shortshort -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyteabsoluteRelativeTo(int cx, int cy) booleanadjacentTo(Tile tile) intarray()block()shortblockID()booleanstatic voidbuildDestroyed(mindustry.gen.Building build) static voidbuildHealthUpdate(arc.struct.IntSeq buildings) <T extends Block>
Tcblock()intcenterX()intcenterY()protected voidchangeBuild(Team team, arc.func.Prov<mindustry.gen.Building> entityprov, int rotation) protected voidchanged()voidvoidcircle(int radius, arc.func.Intc2 cons) voidbooleanvoiddisplay(arc.scene.ui.layout.Table table) floatdrawx()floatdrawy()drop()protected voidprotected voidfloor()shortfloorID()arc.math.geom.RectgetBounds(arc.math.geom.Rect rect) floatReturns the flammability of the tile.arc.math.geom.RectgetHitbox(arc.math.geom.Rect rect) voidgetLinkedTiles(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.voidgetLinkedTilesAs(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.longintfloatgetX()floatgetY()voidhitbox(arc.math.geom.Rect rect) booleaninteractable(Team team) booleanisCenter()booleanbooleanbooleanlegSolid()nearby(int rotation) nearby(int dx, int dy) nearby(arc.math.geom.Point2 relative) mindustry.gen.BuildingnearbyBuild(int rotation) overlay()shortbooleanpassable()intpos()Returns this tile's position as a packed point.protected voidvoidrecache()voidstatic intrelativeTo(float x, float y, float cx, float cy) byterelativeTo(int cx, int cy) Return relative rotation to a coordinate.static byterelativeTo(int x, int y, int cx, int cy) byterelativeTo(Tile tile) voidremove()voidremove()-s this tile, except it's synced across the networkstatic voidremoveTile(Tile tile) voidsetAir()Sets the block to air.voidvoidvoidvoidvoidstatic voidvoidsetFloorNet(Block floor) set()-s this tile, except it's synced across the networkvoidsetFloorNet(Block floor, Block overlay) set()-s this tile, except it's synced across the networkvoidset()-s this tile, except it's synced across the networkvoidset()-s this tile, except it's synced across the networkvoidsetOverlay(Block block) static voidsetOverlay(Tile tile, Block overlay) voidsetOverlayNet(Block overlay) set()-s this tile, except it's synced across the networkvoidsetOverlayQuiet(Block block) Sets the overlay without a recache.voidsetPackedData(long packed) Sets the packed data as obtained fromgetPackedData()voidDo not call unless you know what you are doing! This does not update the indexer!static voidstatic voidstatic voidstatic voidsetTileBlocks(Block block, Team team, int[] positions) Positions are in 'packed position' format - left bits x, right bits y.static voidsetTileFloors(Block block, int[] positions) Positions are in 'packed position' format - left bits x, right bits y.static voidsetTileOverlays(Block block, int[] positions) Positions are in 'packed position' format - left bits x, right bits y.booleanbooleansolid()intbooleanWhether this block was placed by a player/unit.team()toString()wallDrop()floatworldx()floatworldy()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface mindustry.ui.Displayable
displayableMethods inherited from interface arc.math.geom.Position
angleTo, angleTo, dst, dst, dst2, dst2, within, within
-
Field Details
-
data
public byte dataExtra data for specific blocks. Only saved if Block#saveData is true. It is generally recommended that blocks only access data in their own category unless necessary - for example, a floor should not read/write overlay data. However, one byte may sometimes not be enough to hold enough data, in which case "overlapping" data storage is necessary. -
floorData
public byte floorDataExtra data for specific blocks. Only saved if Block#saveData is true. It is generally recommended that blocks only access data in their own category unless necessary - for example, a floor should not read/write overlay data. However, one byte may sometimes not be enough to hold enough data, in which case "overlapping" data storage is necessary. -
overlayData
public byte overlayDataExtra data for specific blocks. Only saved if Block#saveData is true. It is generally recommended that blocks only access data in their own category unless necessary - for example, a floor should not read/write overlay data. However, one byte may sometimes not be enough to hold enough data, in which case "overlapping" data storage is necessary. -
extraData
public int extraDataEven more data for blocks. Use with caution; any floor/block can access this value. Due to 8-byte alignment of Java objects, this extra 4-byte field can be added with no additional cost. -
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
-
isEditorTile
public boolean isEditorTile() -
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() -
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:
hitboxin interfacearc.math.geom.QuadTree.QuadTreeObject
-
nearby
-
nearby
-
nearby
-
nearbyBuild
@Nullable public mindustry.gen.Building nearbyBuild(int rotation) -
interactable
-
drop
-
wallDrop
-
shouldSaveData
public boolean shouldSaveData() -
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() -
getPackedData
public long getPackedData()- Returns:
- all extra tile data, packed into a single long for data transfer convenience.
-
setPackedData
public void setPackedData(long packed) Sets the packed data as obtained fromgetPackedData() -
display
public void display(arc.scene.ui.layout.Table table) - Specified by:
displayin interfaceDisplayable
-
getX
public float getX()- Specified by:
getXin interfacearc.math.geom.Position
-
getY
public float getY()- Specified by:
getYin 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)
-