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!
40 lines
942 B
Java
40 lines
942 B
Java
package electroblob.wizardry.spell;
|
|
|
|
import electroblob.wizardry.util.SpellModifiers;
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
import net.minecraft.init.Items;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.potion.PotionEffect;
|
|
|
|
public class CureEffects extends SpellBuff {
|
|
|
|
public CureEffects(){
|
|
super("cure_effects", 0.8f, 0.8f, 1);
|
|
this.soundValues(0.7f, 1.2f, 0.4f);
|
|
}
|
|
|
|
@Override
|
|
protected boolean applyEffects(EntityLivingBase caster, SpellModifiers modifiers){
|
|
|
|
if(!caster.getActivePotionEffects().isEmpty()){
|
|
|
|
ItemStack milk = new ItemStack(Items.MILK_BUCKET);
|
|
|
|
boolean flag = false;
|
|
|
|
for(PotionEffect effect : caster.getActivePotionEffects()){
|
|
// The PotionEffect version (as opposed to Potion) does not call cleanup callbacks
|
|
if(effect.isCurativeItem(milk)){
|
|
caster.removePotionEffect(effect.getPotion());
|
|
flag = true;
|
|
}
|
|
}
|
|
|
|
return flag;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
}
|