Various crashes fixed

This commit is contained in:
Anuken
2018-08-14 10:41:54 -04:00
parent 61ad9bc47d
commit fda9e6bb9c
11 changed files with 15 additions and 10 deletions

View File

@@ -202,6 +202,11 @@ public interface BuilderTrait extends Entity{
//otherwise, update it.
BuildEntity entity = tile.entity();
if(entity == null){
getPlaceQueue().removeFirst();
return;
}
//deconstructing is 2x as fast
if(current.remove){
entity.deconstruct(unit, core, 2f / entity.buildCost * Timers.delta() * getBuildPower(tile));

View File

@@ -429,7 +429,7 @@ public class Drone extends FlyingUnit implements BuilderTrait{
@Override
public void write(DataOutput data) throws IOException{
super.write(data);
data.writeInt(mineTile == null ? -1 : mineTile.packedPosition());
data.writeInt(mineTile == null || !state.is(mine) ? -1 : mineTile.packedPosition());
data.writeInt(state.is(repair) && target instanceof TileEntity ? ((TileEntity)target).tile.packedPosition() : -1);
writeBuilding(data);
}