This commit is contained in:
Anuken
2023-06-18 09:06:52 -04:00
parent 7e23272668
commit 54d7f3e17c
3 changed files with 5 additions and 5 deletions

View File

@@ -37,7 +37,7 @@ public class BuildPlan implements Position, QuadTreeObject{
public BuildPlan(int x, int y, int rotation, Block block){ public BuildPlan(int x, int y, int rotation, Block block){
this.x = x; this.x = x;
this.y = y; this.y = y;
this.rotation = block.planRotation(rotation); if(block != null) this.rotation = block.planRotation(rotation);
this.block = block; this.block = block;
this.breaking = false; 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){ public BuildPlan(int x, int y, int rotation, Block block, Object config){
this.x = x; this.x = x;
this.y = y; this.y = y;
this.rotation = block.planRotation(rotation); if(block != null) this.rotation = block.planRotation(rotation);
this.block = block; this.block = block;
this.breaking = false; this.breaking = false;
this.config = config; this.config = config;
@@ -138,7 +138,7 @@ public class BuildPlan implements Position, QuadTreeObject{
public BuildPlan set(int x, int y, int rotation, Block block){ public BuildPlan set(int x, int y, int rotation, Block block){
this.x = x; this.x = x;
this.y = y; this.y = y;
this.rotation = block.planRotation(rotation); if(block != null) this.rotation = block.planRotation(rotation);
this.block = block; this.block = block;
this.breaking = false; this.breaking = false;
return this; return this;

View File

@@ -178,7 +178,7 @@ public class DesktopInput extends InputHandler{
} }
linePlans.each(this::drawOverPlan); linePlans.each(this::drawOverPlan);
}else if(isPlacing()){ }else if(isPlacing()){
int rot = block.planRotation(rotation); int rot = block == null ? rotation : block.planRotation(rotation);
if(block.rotate && block.drawArrow){ if(block.rotate && block.drawArrow){
drawArrow(block, cursorX, cursorY, rot); drawArrow(block, cursorX, cursorY, rot);
} }

View File

@@ -415,7 +415,7 @@ public class MobileInput extends InputHandler implements GestureListener{
//draw last placed plan //draw last placed plan
if(!plan.breaking && plan == lastPlaced && plan.block != null){ 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); boolean valid = validPlace(tile.x, tile.y, plan.block, rot);
Draw.mixcol(); Draw.mixcol();
plan.block.drawPlace(tile.x, tile.y, rot, valid); plan.block.drawPlace(tile.x, tile.y, rot, valid);