Also prevent these two from being cast through walls

This commit is contained in:
Electroblob77
2020-04-21 22:10:55 +01:00
parent 5d8a90167c
commit 755933486c
2 changed files with 12 additions and 1 deletions
@@ -218,6 +218,10 @@ public class Grapple extends Spell {
// because the entity will have moved!
Vec3d targetVec = new Vec3d(target.posX, target.getEntityBoundingBox().minY + target.height/2, target.posZ);
RayTraceResult hit = findTarget(world, caster, origin, targetVec.subtract(origin).normalize(), modifiers);
if(hit.typeOfHit != RayTraceResult.Type.ENTITY || hit.entityHit != target) return false; // Something was in the way
double distance = origin.distanceTo(targetVec);
// Can't cast the spell at all if the target is too far away