Added a null check to the Thorn Chakram to prevent it from crashing if the entity that threw it is unloaded. Closes #1944

This commit is contained in:
Vasco Lavos committed 2016-10-14 18:36:21 +01:00
1 parent ee96f3366d
commit f684ebc80d
1 file changed
+7 -5
@@ -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