diff --git a/core/src/mindustry/entities/units/BuildPlan.java b/core/src/mindustry/entities/units/BuildPlan.java index f4f1f1fb07..5390f3451f 100644 --- a/core/src/mindustry/entities/units/BuildPlan.java +++ b/core/src/mindustry/entities/units/BuildPlan.java @@ -37,7 +37,7 @@ public class BuildPlan implements Position, QuadTreeObject{ public BuildPlan(int x, int y, int rotation, Block block){ this.x = x; this.y = y; - this.rotation = block.planRotation(rotation); + if(block != null) this.rotation = block.planRotation(rotation); this.block = block; this.breaking = false; } @@ -46,7 +46,7 @@ public class BuildPlan implements Position, QuadTreeObject{ public BuildPlan(int x, int y, int rotation, Block block, Object config){ this.x = x; this.y = y; - this.rotation = block.planRotation(rotation); + if(block != null) this.rotation = block.planRotation(rotation); this.block = block; this.breaking = false; this.config = config; @@ -138,7 +138,7 @@ public class BuildPlan implements Position, QuadTreeObject{ public BuildPlan set(int x, int y, int rotation, Block block){ this.x = x; this.y = y; - this.rotation = block.planRotation(rotation); + if(block != null) this.rotation = block.planRotation(rotation); this.block = block; this.breaking = false; return this; diff --git a/core/src/mindustry/input/DesktopInput.java b/core/src/mindustry/input/DesktopInput.java index 11e0e77139..c4fcaa041e 100644 --- a/core/src/mindustry/input/DesktopInput.java +++ b/core/src/mindustry/input/DesktopInput.java @@ -178,7 +178,7 @@ public class DesktopInput extends InputHandler{ } linePlans.each(this::drawOverPlan); }else if(isPlacing()){ - int rot = block.planRotation(rotation); + int rot = block == null ? rotation : block.planRotation(rotation); if(block.rotate && block.drawArrow){ drawArrow(block, cursorX, cursorY, rot); } diff --git a/core/src/mindustry/input/MobileInput.java b/core/src/mindustry/input/MobileInput.java index a89dac183a..0f1ef51a69 100644 --- a/core/src/mindustry/input/MobileInput.java +++ b/core/src/mindustry/input/MobileInput.java @@ -415,7 +415,7 @@ public class MobileInput extends InputHandler implements GestureListener{ //draw last placed plan if(!plan.breaking && plan == lastPlaced && plan.block != null){ - int rot = block.planRotation(rotation); + int rot = block == null ? rotation : block.planRotation(rotation); boolean valid = validPlace(tile.x, tile.y, plan.block, rot); Draw.mixcol(); plan.block.drawPlace(tile.x, tile.y, rot, valid);