Package mindustry.input
Class Placement
java.lang.Object
mindustry.input.Placement
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
calculateBridges
(arc.struct.Seq<BuildPlan> plans, DirectionBridge bridge, boolean hasJunction, arc.func.Boolf<Block> avoid) static void
calculateBridges
(arc.struct.Seq<BuildPlan> plans, ItemBridge bridge) static void
calculateBridges
(arc.struct.Seq<BuildPlan> plans, ItemBridge bridge, boolean hasJunction, arc.func.Boolf<Block> avoid) static void
calculateNodes
(arc.struct.Seq<arc.math.geom.Point2> points, Block block, int rotation, arc.func.Boolf2<arc.math.geom.Point2, arc.math.geom.Point2> overlapper) Calculates optimal node placement for nodes with spacing.static boolean
isSidePlace
(arc.struct.Seq<BuildPlan> plans) 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.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.static arc.struct.Seq<arc.math.geom.Point2>
normalizeLine
(int startX, int startY, int endX, int endY) Normalize two points into one straight line, no diagonals.static arc.struct.Seq<arc.math.geom.Point2>
normalizeRectangle
(int startX, int startY, int endX, int endY, int blockSize) Normalize two points into a rectangle.static arc.struct.Seq<arc.math.geom.Point2>
pathfindLine
(boolean conveyors, int startX, int startY, int endX, int endY) Normalize a diagonal line into points.static arc.struct.Seq<arc.math.geom.Point2>
upgradeLine
(int startX, int startY, int endX, int endY)
-
Constructor Details
-
Placement
public Placement()
-
-
Method Details
-
pathfindLine
public static arc.struct.Seq<arc.math.geom.Point2> pathfindLine(boolean conveyors, int startX, int startY, int endX, int endY) Normalize a diagonal line into points. -
normalizeLine
public static arc.struct.Seq<arc.math.geom.Point2> normalizeLine(int startX, int startY, int endX, int endY) Normalize two points into one straight line, no diagonals. -
normalizeRectangle
public static arc.struct.Seq<arc.math.geom.Point2> normalizeRectangle(int startX, int startY, int endX, int endY, int blockSize) Normalize two points into a rectangle. -
upgradeLine
public static arc.struct.Seq<arc.math.geom.Point2> upgradeLine(int startX, int startY, int endX, int endY) -
calculateNodes
public static void calculateNodes(arc.struct.Seq<arc.math.geom.Point2> points, Block block, int rotation, arc.func.Boolf2<arc.math.geom.Point2, arc.math.geom.Point2> overlapper) Calculates optimal node placement for nodes with spacing. Used for bridges and power nodes. -
isSidePlace
-
calculateBridges
-
calculateBridges
public static void calculateBridges(arc.struct.Seq<BuildPlan> plans, ItemBridge bridge, boolean hasJunction, arc.func.Boolf<Block> avoid) -
calculateBridges
public static void calculateBridges(arc.struct.Seq<BuildPlan> plans, DirectionBridge bridge, boolean hasJunction, arc.func.Boolf<Block> avoid) -
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 drawnstartx
- starting X coordinatestarty
- starting Y coordinateendx
- ending X coordinateendy
- ending Y coordinatesnap
- whether to snap to a linemaxLength
- 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 coordinatetiley
- starting Y coordinateendx
- ending X coordinateendy
- ending Y coordinatesnap
- whether to snap to a linerotation
- placement rotationmaxLength
- maximum length of area
-