Class BuildPlan

java.lang.Object
mindustry.entities.units.BuildPlan
All Implemented Interfaces:
arc.math.geom.Position, arc.math.geom.QuadTree.QuadTreeObject

public class BuildPlan extends Object implements arc.math.geom.Position, arc.math.geom.QuadTree.QuadTreeObject
Class for storing build plans. Can be either a place or remove plan.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    float
    Visual scale.
    Block being placed.
    boolean
    Whether this is a break plan.
    boolean
    Whether construction has started for this plan.
    Config int.
    boolean
    Whether construction has started for this plan.
    int
    Original position, only used in schematics.
    int
    Original position, only used in schematics.
    int
    Original position, only used in schematics.
    int
    Original position, only used in schematics.
    float
    Last progress.
    int
    Position and rotation of this plan.
    boolean
    Whether construction has started for this plan.
    boolean
    If true, this plan is in the world.
    int
    Position and rotation of this plan.
    int
    Position and rotation of this plan.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    BuildPlan(int x, int y)
    This creates a remove plan.
    BuildPlan(int x, int y, int rotation, Block block)
    This creates a build plan.
    BuildPlan(int x, int y, int rotation, Block block, Object config)
    This creates a build plan with a config.
  • Method Summary

    Modifier and Type
    Method
    Description
    arc.math.geom.Rect
    bounds(arc.math.geom.Rect rect)
     
    mindustry.gen.Building
     
     
    float
     
    float
     
    float
     
    float
     
    void
    hitbox(arc.math.geom.Rect out)
     
    boolean
     
    boolean
     
    original(int x, int y, int originalWidth, int originalHeight)
     
    boolean
     
    void
    pointConfig(arc.func.Cons<arc.math.geom.Point2> cons)
    Transforms the internal position of this config using the specified function.
    static Object
    pointConfig(Block block, Object config, arc.func.Cons<arc.math.geom.Point2> cons)
    Transforms the internal position of this config using the specified function, and return the result.
    boolean
     
    set(int x, int y, int rotation, Block block)
     
     
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface arc.math.geom.Position

    angleTo, angleTo, dst, dst, dst2, dst2, within, within
  • Field Details

    • x

      public int x
      Position and rotation of this plan.
    • y

      public int y
      Position and rotation of this plan.
    • rotation

      public int rotation
      Position and rotation of this plan.
    • block

      @Nullable public Block block
      Block being placed. If null, this is a breaking plan.
    • breaking

      public boolean breaking
      Whether this is a break plan.
    • config

      public Object config
      Config int. Not used unless hasConfig is true.
    • originalX

      public int originalX
      Original position, only used in schematics.
    • originalY

      public int originalY
      Original position, only used in schematics.
    • originalWidth

      public int originalWidth
      Original position, only used in schematics.
    • originalHeight

      public int originalHeight
      Original position, only used in schematics.
    • progress

      public float progress
      Last progress.
    • initialized

      public boolean initialized
      Whether construction has started for this plan.
    • stuck

      public boolean stuck
      Whether construction has started for this plan.
    • cachedValid

      public boolean cachedValid
      Whether construction has started for this plan.
    • worldContext

      public boolean worldContext
      If true, this plan is in the world. If false, it is being rendered in a schematic.
    • animScale

      public float animScale
      Visual scale. Used only for rendering.
  • Constructor Details

    • BuildPlan

      public BuildPlan(int x, int y, int rotation, Block block)
      This creates a build plan.
    • BuildPlan

      public BuildPlan(int x, int y, int rotation, Block block, Object config)
      This creates a build plan with a config.
    • BuildPlan

      public BuildPlan(int x, int y)
      This creates a remove plan.
    • BuildPlan

      public BuildPlan()
  • Method Details

    • placeable

      public boolean placeable(Team team)
    • isRotation

      public boolean isRotation(Team team)
    • samePos

      public boolean samePos(BuildPlan other)
    • pointConfig

      public static Object pointConfig(Block block, Object config, arc.func.Cons<arc.math.geom.Point2> cons)
      Transforms the internal position of this config using the specified function, and return the result.
    • pointConfig

      public void pointConfig(arc.func.Cons<arc.math.geom.Point2> cons)
      Transforms the internal position of this config using the specified function.
    • copy

      public BuildPlan copy()
    • original

      public BuildPlan original(int x, int y, int originalWidth, int originalHeight)
    • bounds

      public arc.math.geom.Rect bounds(arc.math.geom.Rect rect)
    • set

      public BuildPlan set(int x, int y, int rotation, Block block)
    • drawx

      public float drawx()
    • drawy

      public float drawy()
    • isDone

      public boolean isDone()
    • tile

      @Nullable public Tile tile()
    • build

      @Nullable public mindustry.gen.Building build()
    • hitbox

      public void hitbox(arc.math.geom.Rect out)
      Specified by:
      hitbox in interface arc.math.geom.QuadTree.QuadTreeObject
    • getX

      public float getX()
      Specified by:
      getX in interface arc.math.geom.Position
    • getY

      public float getY()
      Specified by:
      getY in interface arc.math.geom.Position
    • toString

      public String toString()
      Overrides:
      toString in class Object