Also prevent these two from being cast through walls
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -129,7 +129,8 @@ public class SpellConstructRanged<T extends EntityMagicConstruct> 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<T extends EntityMagicConstruct> 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
|
||||
|
||||
Reference in New Issue
Block a user