Fixed infinite red square, glitchy shadows

This commit is contained in:
Anuken
2018-07-08 17:04:32 -04:00
parent a2a0c2f791
commit a0e94577fc
10 changed files with 283 additions and 286 deletions
@@ -209,7 +209,9 @@ public class TileEntity extends BaseEntity implements TargetTrait {
}
tile.block().update(tile);
cons.update(this);
if(cons != null){
cons.update(this);
}
}
}
@@ -58,7 +58,12 @@ public interface BuilderTrait extends Entity{
/**Build power, can be any float. 1 = builds recipes in normal time, 0 = doesn't build at all.*/
float getBuildPower(Tile tile);
default void writeBuilding(DataOutput output) throws IOException{
/**Whether this type of builder can begin creating new blocks.*/
default boolean canCreateBlocks(){
return true;
}
default void writeBuilding(DataOutput output) throws IOException {
BuildRequest request = getCurrentRequest();
if(request != null){
@@ -172,9 +177,9 @@ public interface BuilderTrait extends Entity{
Tile tile = world.tile(current.x, current.y);
if (!(tile.block() instanceof BuildBlock)) {
if(!current.remove && Build.validPlace(unit.getTeam(), current.x, current.y, current.recipe.result, current.rotation)) {
if(canCreateBlocks() && !current.remove && Build.validPlace(unit.getTeam(), current.x, current.y, current.recipe.result, current.rotation)) {
Build.beginPlace(unit.getTeam(), current.x, current.y, current.recipe, current.rotation);
}else if(current.remove && Build.validBreak(unit.getTeam(), current.x, current.y)){
}else if(canCreateBlocks() && current.remove && Build.validBreak(unit.getTeam(), current.x, current.y)){
Build.beginBreak(unit.getTeam(), current.x, current.y);
}else{
getPlaceQueue().removeFirst();
@@ -201,6 +201,11 @@ public class Drone extends FlyingUnit implements BuilderTrait {
return false;
}
@Override
public boolean canCreateBlocks() {
return false;
}
@Override
public void write(DataOutput data) throws IOException {
super.write(data);