/*
 * Copyright  2014 - 2017 | 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 net.wurstclient.features.mods;

import net.minecraft.network.play.client.CPacketPlayer;
import net.wurstclient.compatibility.WConnection;
import net.wurstclient.compatibility.WMinecraft;
import net.wurstclient.events.listeners.UpdateListener;

@Mod.Info(
	description = "Blocks damage from catching on fire.\n"
		+ "Does NOT block damage from standing inside of fire.\n"
		+ "Requires a full hunger bar.",
	name = "AntiFire",
	tags = "anti fire, AntiBurn, anti burn, NoFire, no fire",
	help = "Mods/AntiFire")
@Mod.Bypasses(ghostMode = false, latestNCP = false, olderNCP = false)
public final class AntiFireMod extends Mod implements UpdateListener
{
	@Override
	public void onEnable()
	{
		wurst.events.add(UpdateListener.class, this);
	}
	
	@Override
	public void onUpdate()
	{
		if(!WMinecraft.getPlayer().capabilities.isCreativeMode
			&& WMinecraft.getPlayer().onGround
			&& WMinecraft.getPlayer().isBurning())
			for(int i = 0; i < 100; i++)
				WConnection.sendPacket(new CPacketPlayer());
	}
	
	@Override
	public void onDisable()
	{
		wurst.events.remove(UpdateListener.class, this);
	}
}

@@ -1051,26 +1051,140 @@
 d on
-Update()%0A%09%7B
+Disable()%0A%09%7B%0A%09%09wurst.events.remove(UpdateListener.class, this);%0A%09%7D%0A%09%0A%09@Override%0A%09public void onUpdate()%0A%09%7B%0A%09%09// check gamemode
 %0A%09%09if(
-!
 WMin
@@ -1229,23 +1229,58 @@
 tiveMode
+)
 %0A%09%09%09
-&& 
+return;%0A%09%09%0A%09%09// check onGround%0A%09%09if(!
 WMinecra
@@ -1306,15 +1306,52 @@
 ound
+)
 %0A%09%09%09
-&& 
+return;%0A%09%09%0A%09%09// check if burning%0A%09%09if(!
 WMin
@@ -1383,16 +1383,47 @@
 ing())%0A%09
+%09%09return;%0A%09%09%0A%09%09// send updates%0A
 %09%09for(in
@@ -1445,17 +1445,16 @@
 0; i++)%0A
-%09
 %09%09%09WConn
@@ -1500,101 +1500,6 @@
 %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%7D%0A
 %7D%0A

Update AntiFireMod