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.
This commit is contained in:
@@ -3,48 +3,28 @@ package electroblob.wizardry.spell;
|
||||
import electroblob.wizardry.constants.Element;
|
||||
import electroblob.wizardry.constants.SpellType;
|
||||
import electroblob.wizardry.constants.Tier;
|
||||
import electroblob.wizardry.item.IConjuredItem;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FlamingAxe extends Spell {
|
||||
public class FlamingAxe extends SpellConjuration {
|
||||
|
||||
public FlamingAxe(){
|
||||
super(Tier.ADVANCED, 45, Element.FIRE, "flaming_axe", SpellType.UTILITY, 50, EnumAction.BOW, false);
|
||||
super("flaming_axe", Tier.ADVANCED, Element.FIRE, SpellType.UTILITY, 45, 50, WizardryItems.flaming_axe, SoundEvents.ENTITY_BLAZE_SHOOT);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){
|
||||
|
||||
ItemStack flamingaxe = new ItemStack(WizardryItems.flaming_axe);
|
||||
|
||||
IConjuredItem.setDurationMultiplier(flamingaxe, modifiers.get(WizardryItems.duration_upgrade));
|
||||
|
||||
if(!WizardryUtilities.doesPlayerHaveItem(caster, WizardryItems.flaming_axe)
|
||||
&& ConjureBow.conjureItemInInventory(caster, flamingaxe)){
|
||||
|
||||
if(world.isRemote){
|
||||
for(int i = 0; i < 10; i++){
|
||||
double x1 = (double)((float)caster.posX + world.rand.nextFloat() * 2 - 1.0F);
|
||||
double y1 = (double)((float)WizardryUtilities.getPlayerEyesPos(caster) - 0.5F
|
||||
+ world.rand.nextFloat());
|
||||
double z1 = (double)((float)caster.posZ + world.rand.nextFloat() * 2 - 1.0F);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, x1, y1, z1, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
WizardryUtilities.playSoundAtPlayer(caster, SoundEvents.ENTITY_BLAZE_SHOOT, 1, 1);
|
||||
return true;
|
||||
protected void spawnParticles(World world, EntityLivingBase caster, SpellModifiers modifiers){
|
||||
|
||||
for(int i=0; i<10; i++){
|
||||
double x = caster.posX + world.rand.nextDouble() * 2 - 1;
|
||||
double y = caster.getEntityBoundingBox().minY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble();
|
||||
double z = caster.posZ + world.rand.nextDouble() * 2 - 1;
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, x, y, z, 0, 0, 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user