Initial 1.11.2 update
This commit is contained in:
@@ -16,7 +16,7 @@ import net.minecraft.world.World;
|
||||
|
||||
public class ArrowRain extends Spell {
|
||||
|
||||
public ArrowRain() {
|
||||
public ArrowRain(){
|
||||
super(Tier.MASTER, 75, Element.SORCERY, "arrow_rain", SpellType.ATTACK, 300, EnumAction.NONE, false);
|
||||
}
|
||||
|
||||
@@ -26,26 +26,30 @@ public class ArrowRain extends Spell {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers) {
|
||||
|
||||
RayTraceResult rayTrace = WizardryUtilities.rayTrace(20*modifiers.get(WizardryItems.range_upgrade), world, caster, false);
|
||||
|
||||
public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){
|
||||
|
||||
RayTraceResult rayTrace = WizardryUtilities.rayTrace(20 * modifiers.get(WizardryItems.range_upgrade), world,
|
||||
caster, false);
|
||||
|
||||
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.BLOCK){
|
||||
if(!world.isRemote){
|
||||
double x = rayTrace.hitVec.xCoord;
|
||||
double y = rayTrace.hitVec.yCoord;
|
||||
double z = rayTrace.hitVec.zCoord;
|
||||
// Moves the entity back towards the caster a bit, so the area of effect is better centred on the position.
|
||||
// Moves the entity back towards the caster a bit, so the area of effect is better centred on the
|
||||
// position.
|
||||
// 3.0d is the distance to move the entity back towards the caster.
|
||||
double dx = caster.posX - x;
|
||||
double dz = caster.posZ - z;
|
||||
double distRatio = 3.0d/Math.sqrt(dx*dx + dz*dz);
|
||||
x += dx*distRatio;
|
||||
z += dz*distRatio;
|
||||
|
||||
EntityArrowRain arrowrain = new EntityArrowRain(world, x, y + 5, z, caster, (int)(120*modifiers.get(WizardryItems.duration_upgrade)), modifiers.get(SpellModifiers.DAMAGE));
|
||||
double distRatio = 3.0d / Math.sqrt(dx * dx + dz * dz);
|
||||
x += dx * distRatio;
|
||||
z += dz * distRatio;
|
||||
|
||||
EntityArrowRain arrowrain = new EntityArrowRain(world, x, y + 5, z, caster,
|
||||
(int)(120 * modifiers.get(WizardryItems.duration_upgrade)),
|
||||
modifiers.get(SpellModifiers.DAMAGE));
|
||||
arrowrain.rotationYaw = caster.rotationYawHead;
|
||||
world.spawnEntityInWorld(arrowrain);
|
||||
world.spawnEntity(arrowrain);
|
||||
}
|
||||
caster.swingArm(hand);
|
||||
WizardryUtilities.playSoundAtPlayer(caster, WizardrySounds.SPELL_SUMMONING, 1.0F, 1.0F);
|
||||
|
||||
Reference in New Issue
Block a user