f37812be3e
I may have got a bit behind with version control. A lot behind, in fact. Maybe I'll go back and split this sometime - then again, I probably won't. But hey, at least it's here!
54 lines
1.6 KiB
Java
54 lines
1.6 KiB
Java
package electroblob.wizardry.spell;
|
|
|
|
import electroblob.wizardry.potion.Curse;
|
|
import electroblob.wizardry.util.ParticleBuilder;
|
|
import electroblob.wizardry.util.ParticleBuilder.Type;
|
|
import electroblob.wizardry.util.SpellModifiers;
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
import net.minecraft.potion.PotionEffect;
|
|
import net.minecraft.world.World;
|
|
|
|
public class RemoveCurse extends SpellBuff {
|
|
|
|
public RemoveCurse(){
|
|
super("remove_curse", 1, 1, 0.3f);
|
|
this.soundValues(0.7f, 1.2f, 0.4f);
|
|
}
|
|
|
|
@Override
|
|
protected boolean applyEffects(EntityLivingBase caster, SpellModifiers modifiers){
|
|
|
|
if(!caster.getActivePotionEffects().isEmpty()){
|
|
|
|
boolean flag = false;
|
|
|
|
for(PotionEffect effect : caster.getActivePotionEffects()){
|
|
// The PotionEffect version (as opposed to Potion) does not call cleanup callbacks
|
|
if(effect.getPotion() instanceof Curse){
|
|
caster.removePotionEffect(effect.getPotion());
|
|
flag = true;
|
|
}
|
|
}
|
|
|
|
return flag;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
protected void spawnParticles(World world, EntityLivingBase caster, SpellModifiers modifiers){
|
|
|
|
super.spawnParticles(world, caster, modifiers);
|
|
|
|
for(int i = 0; i < particleCount*2; 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;
|
|
ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).vel(0, 0.14, 0).clr(0x0f001b)
|
|
.time(20 + world.rand.nextInt(12)).spawn(world);
|
|
ParticleBuilder.create(Type.DARK_MAGIC).pos(x, y, z).clr(0x0f001b).spawn(world);
|
|
}
|
|
}
|
|
}
|