From f684ebc80d81edbe671f871e4799b69167ba77a6 Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Fri, 14 Oct 2016 18:36:21 +0100 Subject: [PATCH] Added a null check to the Thorn Chakram to prevent it from crashing if the entity that threw it is unloaded. Closes #1944 --- .../botania/common/entity/EntityThornChakram.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/vazkii/botania/common/entity/EntityThornChakram.java b/src/main/java/vazkii/botania/common/entity/EntityThornChakram.java index 2dc7df6ac..bd1c0fbf0 100644 --- a/src/main/java/vazkii/botania/common/entity/EntityThornChakram.java +++ b/src/main/java/vazkii/botania/common/entity/EntityThornChakram.java @@ -81,11 +81,13 @@ public class EntityThornChakram extends EntityThrowable { // Returning motion if(isReturning()) { - Entity thrower = worldObj.getEntityByID(getEntityToReturnTo()); - Vector3 motion = Vector3.fromEntityCenter(thrower).subtract(Vector3.fromEntityCenter(this)).normalize(); - motionX = motion.x; - motionY = motion.y; - motionZ = motion.z; + Entity thrower = getThrower(); + if(thrower != null) { + Vector3 motion = Vector3.fromEntityCenter(thrower).subtract(Vector3.fromEntityCenter(this)).normalize(); + motionX = motion.x; + motionY = motion.y; + motionZ = motion.z; + } } // Client FX