From 9aa4219bf00bad7f5998c2ef8df4441f36bb3b7f Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 17 Sep 2018 09:57:58 -0400 Subject: [PATCH] Fixed core deconstruction crash --- .../io/anuke/mindustry/entities/bullet/Bullet.java | 4 ++++ .../mindustry/entities/traits/BuilderTrait.java | 12 +++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/core/src/io/anuke/mindustry/entities/bullet/Bullet.java b/core/src/io/anuke/mindustry/entities/bullet/Bullet.java index 09a37e1960..637727827f 100644 --- a/core/src/io/anuke/mindustry/entities/bullet/Bullet.java +++ b/core/src/io/anuke/mindustry/entities/bullet/Bullet.java @@ -109,6 +109,10 @@ public class Bullet extends BulletEntity implements TeamTrait, SyncT remove(); } + public BulletType getBulletType(){ + return type; + } + public void resetOwner(Entity entity, Team team){ this.owner = entity; this.team = team; diff --git a/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java b/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java index c8ca675c5e..1edf7165b6 100644 --- a/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java +++ b/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java @@ -181,12 +181,7 @@ public interface BuilderTrait extends Entity{ setMineTile(null); } - TileEntity core = unit.getClosestCore(); - //if there is no core to build with, stop building! - if(core == null){ - return; - } Tile tile = world.tile(current.x, current.y); @@ -205,6 +200,13 @@ public interface BuilderTrait extends Entity{ } } + TileEntity core = unit.getClosestCore(); + + //if there is no core to build with, stop building! + if(core == null){ + return; + } + //otherwise, update it. BuildEntity entity = tile.entity();