Class Tile

java.lang.Object
mindustry.world.Tile
All Implemented Interfaces:
Position, QuadTree.QuadTreeObject, Displayable
Direct Known Subclasses:
CachedTile, EditorTile

public class Tile extends Object implements Position, QuadTree.QuadTreeObject, Displayable
  • Field Details

    • data

      public byte data
      Extra data for very specific blocks.
    • build

      @Nullable public mindustry.gen.Building build
      Tile entity, usually null.
    • x

      public short x
    • y

      public short y
    • block

      protected Block block
    • floor

      protected Floor floor
    • overlay

      protected Floor overlay
    • changing

      protected boolean changing
  • Constructor Details

    • Tile

      public Tile(int x, int y)
    • Tile

      public Tile(int x, int y, Block floor, Block overlay, Block wall)
    • 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

      public byte relativeTo(Tile tile)
    • 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

      public Floor floor()
    • block

      public Block block()
    • overlay

      public Floor overlay()
    • cblock

      public <T extends Block> T cblock()
    • team

      public Team team()
    • setTeam

      public void setTeam(Team team)
      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

      public void setBlock(Block type, Team team, int rotation)
    • setBlock

      public void setBlock(Block type, Team team, int rotation, Prov<mindustry.gen.Building> entityprov)
    • setBlock

      public void setBlock(Block type, Team team)
    • setBlock

      public void setBlock(Block type)
    • setFloor

      public void setFloor(Floor type)
      This resets the overlay!
    • isEditorTile

      public boolean isEditorTile()
    • setFloorUnder

      public void setFloorUnder(Floor floor)
      Sets the floor, preserving overlay.
    • setAir

      public void setAir()
      Sets the block to air.
    • circle

      public void circle(int radius, Intc2 cons)
    • circle

      public void circle(int radius, Cons<Tile> cons)
    • 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

      public void setNet(Block block)
      set()-s this tile, except it's synced across the network
    • setNet

      public void setNet(Block block, Team team, int rotation)
      set()-s this tile, except it's synced across the network
    • setFloorNet

      public void setFloorNet(Block floor, Block overlay)
      set()-s this tile, except it's synced across the network
    • setFloorNet

      public void setFloorNet(Block floor)
      set()-s this tile, except it's synced across the network
    • setOverlayNet

      public void setOverlayNet(Block overlay)
      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

      public void setOverlay(Block block)
    • setOverlayQuiet

      public void setOverlayQuiet(Block block)
      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

      public void getLinkedTiles(Cons<Tile> cons)
      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

      public Seq<Tile> getLinkedTiles(Seq<Tile> tmpArray)
      Returns the list of all tiles linked to this multiblock. This array contains all linked tiles, including this tile itself.
    • getLinkedTilesAs

      public Seq<Tile> getLinkedTilesAs(Block block, Seq<Tile> tmpArray)
      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

      public void getLinkedTilesAs(Block block, Cons<Tile> tmpArray)
      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 Rect getHitbox(Rect rect)
    • getBounds

      public Rect getBounds(Rect rect)
    • hitbox

      public void hitbox(Rect rect)
      Description copied from interface: QuadTree.QuadTreeObject
      Fills the out parameter with this element's rough bounding box. This should never be smaller than the actual object, but may be larger.
      Specified by:
      hitbox in interface QuadTree.QuadTreeObject
    • nearby

      @Nullable public Tile nearby(Point2 relative)
    • nearby

      @Nullable public Tile nearby(int dx, int dy)
    • nearby

      @Nullable public Tile nearby(int rotation)
    • nearbyBuild

      @Nullable public mindustry.gen.Building nearbyBuild(int rotation)
    • interactable

      public boolean interactable(Team team)
    • drop

      @Nullable public Item drop()
    • wallDrop

      @Nullable public Item wallDrop()
    • staticDarkness

      public int staticDarkness()
    • legSolid

      public boolean legSolid()
      Returns:
      whether this tile is solid for legged units
    • adjacentTo

      public boolean adjacentTo(Tile tile)
      Returns:
      true if these tiles are right next to each other.
    • preChanged

      protected void preChanged()
    • changeBuild

      protected void changeBuild(Team team, Prov<mindustry.gen.Building> entityprov, int rotation)
    • changed

      protected void changed()
    • fireChanged

      protected void fireChanged()
    • firePreChanged

      protected void firePreChanged()
    • display

      public void display(Table table)
      Specified by:
      display in interface Displayable
    • getX

      public float getX()
      Specified by:
      getX in interface Position
    • getY

      public float getY()
      Specified by:
      getY in interface Position
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setFloor

      public static void setFloor(Tile tile, Block floor, Block overlay)
    • setOverlay

      public static void setOverlay(Tile tile, Block overlay)
    • removeTile

      public static void removeTile(Tile tile)
    • setTile

      public static void setTile(Tile tile, Block block, Team team, int rotation)
    • setTeam

      public static void setTeam(mindustry.gen.Building build, Team team)
    • buildDestroyed

      public static void buildDestroyed(mindustry.gen.Building build)
    • buildHealthUpdate

      public static void buildHealthUpdate(IntSeq buildings)