Reinstate missing null check in SpellRay, fixes part of #519

This commit is contained in:
Electroblob77
2020-10-28 23:43:08 +00:00
parent d3df59df73
commit 315f2e4b02
@@ -178,6 +178,8 @@ public abstract class SpellRay extends Spell {
Vec3d origin = new Vec3d(caster.posX, caster.posY + caster.getEyeHeight() - Y_OFFSET, caster.posZ); Vec3d origin = new Vec3d(caster.posX, caster.posY + caster.getEyeHeight() - Y_OFFSET, caster.posZ);
Vec3d targetPos = null; Vec3d targetPos = null;
if(target != null){
if(!ignoreLivingEntities || !EntityUtils.isLiving(target)){ if(!ignoreLivingEntities || !EntityUtils.isLiving(target)){
targetPos = new Vec3d(target.posX, target.posY + target.height / 2, target.posZ); targetPos = new Vec3d(target.posX, target.posY + target.height / 2, target.posZ);
@@ -194,6 +196,7 @@ public abstract class SpellRay extends Spell {
targetPos = new Vec3d(x + 0.5, y + 1, z + 0.5); targetPos = new Vec3d(x + 0.5, y + 1, z + 0.5);
} }
} }
}
if(targetPos == null) return false; // If there was nothing to aim at (e.g. snare when the target is in the air) if(targetPos == null) return false; // If there was nothing to aim at (e.g. snare when the target is in the air)