Files
Wizardry/src/main/java/electroblob/wizardry/spell/Leap.java
T
Electroblob 29261082f1 Spell hierarchisation and refactoring, plus miscellaneous renaming and minor refactoring
- Adds new generic spell superclasses which aim to group spells such that duplicate code is eliminated, and functions standardised, as much as possible.
- Removes numerous spell classes which are no longer required as a result of this change, and replaces them with instances of the relevant generic spell classes.
- Changes the remaining spell classes to fit with the new system, mostly by having them extend the generic spell classes.
- Completes the transfer of particle spawning to the ParticleBuilder system.
2018-06-20 22:25:54 +01:00

47 lines
1.4 KiB
Java

package electroblob.wizardry.spell;
import electroblob.wizardry.constants.Element;
import electroblob.wizardry.constants.SpellType;
import electroblob.wizardry.constants.Tier;
import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.EnumAction;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.world.World;
public class Leap extends Spell {
public Leap(){
super("leap", Tier.BASIC, Element.EARTH, SpellType.UTILITY, 10, 20, EnumAction.NONE, false);
}
@Override
public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){
if(caster.onGround){
caster.motionY = 0.65 * modifiers.get(SpellModifiers.POTENCY);
caster.addVelocity(caster.getLookVec().x * 0.3, 0, caster.getLookVec().z * 0.3);
if(world.isRemote){
for(int i = 0; i < 10; i++){
double x = (double)(caster.posX + world.rand.nextFloat() - 0.5F);
double y = (double)(caster.getEntityBoundingBox().minY);
double z = (double)(caster.posZ + world.rand.nextFloat() - 0.5F);
world.spawnParticle(EnumParticleTypes.CLOUD, x, y, z, 0, 0, 0);
}
}
WizardryUtilities.playSoundAtPlayer(caster, SoundEvents.ENTITY_ENDERDRAGON_FLAP, 0.5F, 1.0f);
caster.swingArm(hand);
return true;
}
return false;
}
}