diff --git a/src/main/java/electroblob/wizardry/spell/Grapple.java b/src/main/java/electroblob/wizardry/spell/Grapple.java index 22b0df43..437b27b7 100644 --- a/src/main/java/electroblob/wizardry/spell/Grapple.java +++ b/src/main/java/electroblob/wizardry/spell/Grapple.java @@ -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 diff --git a/src/main/java/electroblob/wizardry/spell/SpellConstructRanged.java b/src/main/java/electroblob/wizardry/spell/SpellConstructRanged.java index b48a28ac..04b5059c 100644 --- a/src/main/java/electroblob/wizardry/spell/SpellConstructRanged.java +++ b/src/main/java/electroblob/wizardry/spell/SpellConstructRanged.java @@ -129,7 +129,8 @@ public class SpellConstructRanged extends SpellC SpellModifiers modifiers){ double range = getProperty(RANGE).doubleValue() * modifiers.get(WizardryItems.range_upgrade); - + Vec3d origin = new Vec3d(caster.posX, caster.getEntityBoundingBox().minY + caster.getEyeHeight(), caster.posZ); + if(target != null && caster.getDistance(target) <= range){ if(!world.isRemote){ @@ -138,6 +139,12 @@ public class SpellConstructRanged extends SpellC double y = target.posY; double z = target.posZ; + RayTraceResult hit = world.rayTraceBlocks(origin, new Vec3d(x, y, z), hitLiquids, ignoreUncollidables, false); + + if(hit != null && hit.typeOfHit == RayTraceResult.Type.BLOCK && !hit.getBlockPos().equals(new BlockPos(x, y, z))){ + return false; // Something was in the way + } + EnumFacing side = null; // If the target is not on the ground but the construct must be placed on the floor, searches for the