diff --git a/src/main/java/electroblob/wizardry/spell/MindControl.java b/src/main/java/electroblob/wizardry/spell/MindControl.java index 4fff4f6f..e5ed36c5 100644 --- a/src/main/java/electroblob/wizardry/spell/MindControl.java +++ b/src/main/java/electroblob/wizardry/spell/MindControl.java @@ -24,6 +24,7 @@ import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent; +import net.minecraftforge.event.entity.living.PotionEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -214,4 +215,12 @@ public class MindControl extends SpellRay { processTargeting(event.getEntity().world, (EntityLiving)event.getEntityLiving(), event.getTarget()); } + @SubscribeEvent + public static void onPotionExpiryEvent(PotionEvent.PotionExpiryEvent event){ + if(event.getPotionEffect() != null && event.getPotionEffect().getPotion() == WizardryPotions.mind_control + && event.getEntity() instanceof EntityLiving){ + ((EntityLiving)event.getEntity()).setAttackTarget(null); // End effect + } + } + } \ No newline at end of file