Class Tiles

java.lang.Object
mindustry.world.Tiles
All Implemented Interfaces:
Iterable<Tile>

public class Tiles extends Object implements Iterable<Tile>
A tile container.
  • Field Details

    • width

      public final int width
    • height

      public final int height
  • Constructor Details

    • Tiles

      public Tiles(int width, int height)
  • Method Details

    • each

      public void each(Intc2 cons)
    • fill

      public void fill()
      fills this tile set with empty air tiles.
    • set

      public void set(int x, int y, Tile tile)
      set a tile at a position; does not range-check. use with caution.
    • seti

      public void seti(int i, Tile tile)
      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

      @Nullable public Tile get(int x, int y)
      Returns:
      a tile at coordinates, or null if out of bounds
    • getn

      public Tile getn(int x, int y)
      Returns:
      a tile at coordinates; throws an exception if out of bounds
    • getc

      public Tile getc(int x, int y)
      Returns:
      a tile at coordinates, clamped.
    • geti

      public Tile geti(int idx)
      Returns:
      a tile at an iteration index [0, width * height]
    • getp

      @Nullable public Tile getp(int pos)
      Returns:
      a tile at an int position (not equivalent to geti)
    • eachTile

      public void eachTile(Cons<Tile> cons)
    • iterator

      public Iterator<Tile> iterator()
      Specified by:
      iterator in interface Iterable<Tile>