/*
 * Copyright  2014 - 2016 | Wurst-Imperium | All rights reserved.
 * 
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package tk.wurst_client.mods;

import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.init.MobEffects;
import net.minecraft.network.play.client.CPacketPlayer;
import tk.wurst_client.events.listeners.UpdateListener;

@Mod.Info(
	description = "Blocks bad potion effects.",
	name = "AntiPotion",
	tags = "NoPotion, Zoot, anti potions, no potions",
	help = "Mods/AntiPotion")
@Mod.Bypasses(ghostMode = false, latestNCP = false, olderNCP = false)
public class AntiPotionMod extends Mod implements UpdateListener
{
	@Override
	public void onEnable()
	{
		wurst.events.add(UpdateListener.class, this);
	}
	
	@Override
	public void onUpdate()
	{
		EntityPlayerSP player = mc.player;
		if(!player.capabilities.isCreativeMode && player.onGround
			&& !player.getActivePotionEffects().isEmpty())
			if(player.isPotionActive(MobEffects.HUNGER)
				|| player.isPotionActive(MobEffects.SLOWNESS)
				|| player.isPotionActive(MobEffects.MINING_FATIGUE)
				|| player.isPotionActive(MobEffects.INSTANT_DAMAGE)
				|| player.isPotionActive(MobEffects.NAUSEA)
				|| player.isPotionActive(MobEffects.BLINDNESS)
				|| player.isPotionActive(MobEffects.WEAKNESS)
				|| player.isPotionActive(MobEffects.WITHER)
				|| player.isPotionActive(MobEffects.POISON))
				for(int i = 0; i < 1000; i++)
					player.connection.sendPacket(new CPacketPlayer());
	}
	
	@Override
	public void onDisable()
	{
		wurst.events.remove(UpdateListener.class, this);
	}
}

@@ -307,59 +307,8 @@
 s;%0A%0A
-import net.minecraft.client.entity.EntityPlayerSP;%0A
 impo
@@ -397,16 +397,52 @@
 Player;%0A
+import net.minecraft.potion.Potion;%0A
 import t
@@ -500,18 +500,16 @@
 od.Info(
-%0A%09
 descript
@@ -782,16 +782,273 @@
 tener%0A%7B%0A
+%09private final Potion%5B%5D blockedEffects = new Potion%5B%5D%7BMobEffects.HUNGER,%0A%09%09MobEffects.SLOWNESS, MobEffects.MINING_FATIGUE,%0A%09%09MobEffects.INSTANT_DAMAGE, MobEffects.NAUSEA, MobEffects.BLINDNESS,%0A%09%09MobEffects.WEAKNESS, MobEffects.WITHER, MobEffects.POISON%7D;%0A%09%0A
 %09@Overri
@@ -1156,21 +1156,22 @@
  void on
-Updat
+Disabl
 e()%0A%09%7B%0A%09
@@ -1175,49 +1175,109 @@
 %7B%0A%09%09
-EntityPlayerSP player = mc.player;
+wurst.events.remove(UpdateListener.class, this);%0A%09%7D%0A%09%0A%09@Override%0A%09public void onUpdate()%0A%09%7B
 %0A%09%09if(!
+mc.
 play
@@ -1310,16 +1310,19 @@
 Mode && 
+mc.
 player.o
@@ -1339,465 +1339,273 @@
 %09&& 
-!player.getActivePotionEffects().isEmpty())%0A%09%09%09if(player.isPotionActive(MobEffects.HUNGER
+hasBadEffect())%0A%09%09%09for(int i = 0; i %3C 1000; i++
 )%0A%09%09%09%09
-%7C%7C 
+mc.
 player.
-isPotionActive(MobEffects.SLOWNESS)%0A%09%09%09%09%7C%7C player.isPotionActive(MobEffects.MINING_FATIGUE)%0A%09%09%09%09%7C%7C player.isPotionActive(MobEffects.INSTANT_DAMAGE)%0A%09%09%09%09%7C%7C player.isPotionActive(MobEffects.NAUSEA)%0A%09%09%09%09%7C%7C player.isPotionActive(MobEffects.BLINDNESS)
+connection.sendPacket(new CPacketPlayer());%0A%09%7D%0A%09%0A%09private boolean hasBadEffect()%0A%09%7B%0A%09%09if(mc.player.getActivePotionEffects().isEmpty())%0A%09%09%09return false;
 %0A%09%09
+%0A
 %09%09
-%7C%7C player.isPotionActive(MobEffects.WEAKNESS)%0A%09%09%09%09%7C%7C player.isPotionActive(MobEffects.WITHER)%0A%09%09%09%09%7C%7C 
+for(Potion effect : blockedEffects)%0A%09%09%09if(mc.
 play
@@ -1626,211 +1626,52 @@
 ive(
-MobE
+e
 ffect
-s.POISON))%0A%09%09%09%09for(int i = 0; i %3C 1000; i++)%0A%09%09%09%09%09player.connection.sendPacket(new CPacketPlayer());%0A%09%7D%0A%09%0A%09@Override%0A%09public void onDisable()%0A%09%7B%0A%09%09wurst.events.remove(UpdateListener.class, this)
+))%0A%09%09%09%09return true;%0A%09%09%09%0A%09%09return false
 ;%0A%09%7D

Update AntiPotionMod