More work on the implementation of events
This commit is contained in:
parent
dd3a093825
commit
39b4243a82
27 changed files with 217 additions and 259 deletions
|
@ -31,6 +31,13 @@ public class SpellParadigmMelee extends SpellParadigm
|
|||
@Override
|
||||
public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack)
|
||||
{
|
||||
int cost = this.getTotalCost();
|
||||
|
||||
if(!EnergyItems.syphonBatteries(itemStack, entityPlayer, cost))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (IMeleeSpellEntityEffect effect : entityEffectList)
|
||||
{
|
||||
effect.onEntityImpact(world, entityPlayer);
|
||||
|
@ -40,10 +47,6 @@ public class SpellParadigmMelee extends SpellParadigm
|
|||
{
|
||||
effect.onWorldEffect(world, entityPlayer);
|
||||
}
|
||||
|
||||
int cost = this.getTotalCost();
|
||||
|
||||
EnergyItems.syphonBatteries(itemStack, entityPlayer, cost);
|
||||
}
|
||||
|
||||
public void addEntityEffect(IMeleeSpellEntityEffect eff)
|
||||
|
|
|
@ -45,12 +45,16 @@ public class SpellParadigmProjectile extends SpellParadigm
|
|||
@Override
|
||||
public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack)
|
||||
{
|
||||
int cost = this.getTotalCost();
|
||||
|
||||
if(!EnergyItems.syphonBatteries(itemStack, entityPlayer, cost))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EntitySpellProjectile proj = new EntitySpellProjectile(world, entityPlayer);
|
||||
this.prepareProjectile(proj);
|
||||
world.spawnEntityInWorld(proj);
|
||||
int cost = this.getTotalCost();
|
||||
|
||||
EnergyItems.syphonBatteries(itemStack, entityPlayer, cost);
|
||||
}
|
||||
|
||||
public static SpellParadigmProjectile getParadigmForEffectArray(List<SpellEffect> effectList)
|
||||
|
|
|
@ -29,15 +29,18 @@ public class SpellParadigmSelf extends SpellParadigm
|
|||
public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack)
|
||||
{
|
||||
this.applyAllSpellEffects();
|
||||
|
||||
int cost = this.getTotalCost();
|
||||
|
||||
if(!EnergyItems.syphonBatteries(itemStack, entityPlayer, cost))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (ISelfSpellEffect eff : selfSpellEffectList)
|
||||
{
|
||||
eff.onSelfUse(world, entityPlayer);
|
||||
}
|
||||
|
||||
int cost = this.getTotalCost();
|
||||
|
||||
EnergyItems.syphonBatteries(itemStack, entityPlayer, cost);
|
||||
}
|
||||
|
||||
public void addSelfSpellEffect(ISelfSpellEffect eff)
|
||||
|
|
|
@ -100,8 +100,11 @@ public class SpellParadigmTool extends SpellParadigm
|
|||
}
|
||||
|
||||
int cost = this.getTotalCost();
|
||||
|
||||
EnergyItems.syphonBatteries(crystal, entityPlayer, cost);
|
||||
|
||||
if(!EnergyItems.syphonBatteries(crystal, entityPlayer, cost))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack toolStack = this.prepareTool(crystal, world);
|
||||
|
||||
|
|
|
@ -22,8 +22,6 @@ public abstract class HomSpell implements ISimpleSpell
|
|||
@Override
|
||||
public abstract ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer);
|
||||
|
||||
;
|
||||
|
||||
@Override
|
||||
public abstract ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue