Class Placement

java.lang.Object
mindustry.input.Placement

public class Placement extends Object
  • Constructor Details

    • Placement

      public Placement()
  • Method Details

    • pathfindLine

      public static Seq<Point2> pathfindLine(boolean conveyors, int startX, int startY, int endX, int endY)
      Normalize a diagonal line into points.
    • normalizeLine

      public static Seq<Point2> normalizeLine(int startX, int startY, int endX, int endY)
      Normalize two points into one straight line, no diagonals.
    • upgradeLine

      public static Seq<Point2> upgradeLine(int startX, int startY, int endX, int endY)
    • calculateNodes

      public static void calculateNodes(Seq<Point2> points, Block block, int rotation, Boolf2<Point2,Point2> overlapper)
      Calculates optimal node placement for nodes with spacing. Used for bridges and power nodes.
    • isSidePlace

      public static boolean isSidePlace(Seq<BuildPlan> plans)
    • calculateBridges

      public static void calculateBridges(Seq<BuildPlan> plans, ItemBridge bridge)
    • calculateBridges

      public static void calculateBridges(Seq<BuildPlan> plans, DirectionBridge bridge, boolean hasJunction, Boolf<Block> same)
    • normalizeDrawArea

      public static Placement.NormalizeDrawResult normalizeDrawArea(Block block, int startx, int starty, int endx, int endy, boolean snap, int maxLength, float scaling)
      Normalizes a placement area and returns the result, ready to be used for drawing a rectangle. Returned x2 and y2 will always be greater than x and y.
      Parameters:
      block - block that will be drawn
      startx - starting X coordinate
      starty - starting Y coordinate
      endx - ending X coordinate
      endy - ending Y coordinate
      snap - whether to snap to a line
      maxLength - maximum length of area
    • normalizeArea

      public static Placement.NormalizeResult normalizeArea(int tilex, int tiley, int endx, int endy, int rotation, boolean snap, int maxLength)
      Normalizes a placement area and returns the result. Returned x2 and y2 will always be greater than x and y.
      Parameters:
      tilex - starting X coordinate
      tiley - starting Y coordinate
      endx - ending X coordinate
      endy - ending Y coordinate
      snap - whether to snap to a line
      rotation - placement rotation
      maxLength - maximum length of area