Files
Wizardry/src/main/java/electroblob/wizardry/spell/CureEffects.java
T
Electroblob77 f37812be3e That's one heck of a commit you've got there...
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!
2019-08-18 00:04:18 +01:00

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;
}
}