// Path: src/main/java/com/zalthonethree/zombieinfection/handler/foodchange/ZIFoodChangeMessage.java
// public class ZIFoodChangeMessage extends ZIMessage {
// 	public int foodLevelChange;
// 	public float saturationChange;
// }
// 
// Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessage.java
// public class ZITimeInfectedMessage extends ZIMessage {
// 	public int secondsInfected;
// }
// 
// Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessageHandler.java
// public class ZITimeInfectedMessageHandler extends SimpleChannelInboundHandler<ZITimeInfectedMessage> {
// 	@Override protected void channelRead0(ChannelHandlerContext ctx, ZITimeInfectedMessage msg) throws Exception {
// 		TimeInfectedTrackingClient.setSecondsInfected(msg.secondsInfected);
// 	}
// }
// 
// Path: src/main/java/com/zalthonethree/zombieinfection/utility/Utilities.java
// public class Utilities {
// 	@SideOnly(Side.CLIENT) public static String translate(String string) {
// 		return I18n.format(string);
// 	}
// 	
// 	@SideOnly(Side.CLIENT) public static String translateFormatted(String string, Object... formatargs) {
// 		return I18n.format(string, formatargs);
// 	}
// 	
// 	public static boolean isServerSide() { return FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER; }
// 	public static boolean isClientSide() { return FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT; }
// }


import io.netty.channel.ChannelFutureListener;
import java.util.EnumMap;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.Packet;
import net.minecraft.network.play.INetHandlerPlayClient;
import net.minecraftforge.fml.common.network.FMLEmbeddedChannel;
import net.minecraftforge.fml.common.network.FMLOutboundHandler;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import com.zalthonethree.zombieinfection.handler.foodchange.ZIFoodChangeMessage;
import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessage;
import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessageHandler;
import com.zalthonethree.zombieinfection.utility.Utilities;
package com.zalthonethree.zombieinfection.handler;





public enum PacketHandler {
	INSTANCE;
	
	private EnumMap<Side, FMLEmbeddedChannel> channels;
	
	private PacketHandler() {
		this.channels = NetworkRegistry.INSTANCE.newChannel("ZombieInfection", new ZombieInfectionCodec());
		if (Utilities.isClientSide()) addClientHandler();
		if (Utilities.isServerSide()) addServerHandler();
	}
	
	@SideOnly(Side.CLIENT) private void addClientHandler() {
		FMLEmbeddedChannel clientChannel = this.channels.get(Side.CLIENT);
		
		String codecName = clientChannel.findChannelHandlerNameForType(ZombieInfectionCodec.class);
		clientChannel.pipeline().addAfter(codecName, "ZITimeInfectedHandler", new ZITimeInfectedMessageHandler());
	}
	
	@SideOnly(Side.SERVER) private void addServerHandler() {
		// FMLEmbeddedChannel serverChannel = this.channels.get(Side.SERVER);
		
		// String codecName = serverChannel.findChannelHandlerNameForType(ZombieInfectionCodec.class);
		// Add any messages that the server gets from the client. Shouldn't really be needed. Uncomment lines above if this is needed.
	}
	
	@SuppressWarnings("unchecked") public static Packet<INetHandlerPlayClient> getTimeInfectedUpdatePacket(int Seconds) {
		ZITimeInfectedMessage msg = new ZITimeInfectedMessage();
		msg.index = 0;
		msg.secondsInfected = Seconds;
		
		return (Packet<INetHandlerPlayClient>) INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
	}
	
	@SuppressWarnings("unchecked") public static Packet<INetHandlerPlayClient> getFoodChangePacket(int food, float saturation) {
		ZIFoodChangeMessage msg = new ZIFoodChangeMessage();
		msg.index = 1;
// Path: src/main/java/com/zalthonethree/zombieinfection/handler/foodchange/ZIFoodChangeMessage.java
// public class ZIFoodChangeMessage extends ZIMessage {
// 	public int foodLevelChange;
// 	public float saturationChange;
// }
// 
// Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessage.java
// public class ZITimeInfectedMessage extends ZIMessage {
// 	public int secondsInfected;
// }
// 
// Path: src/main/java/com/zalthonethree/zombieinfection/handler/timeinfected/ZITimeInfectedMessageHandler.java
// public class ZITimeInfectedMessageHandler extends SimpleChannelInboundHandler<ZITimeInfectedMessage> {
// 	@Override protected void channelRead0(ChannelHandlerContext ctx, ZITimeInfectedMessage msg) throws Exception {
// 		TimeInfectedTrackingClient.setSecondsInfected(msg.secondsInfected);
// 	}
// }
// 
// Path: src/main/java/com/zalthonethree/zombieinfection/utility/Utilities.java
// public class Utilities {
// 	@SideOnly(Side.CLIENT) public static String translate(String string) {
// 		return I18n.format(string);
// 	}
// 	
// 	@SideOnly(Side.CLIENT) public static String translateFormatted(String string, Object... formatargs) {
// 		return I18n.format(string, formatargs);
// 	}
// 	
// 	public static boolean isServerSide() { return FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER; }
// 	public static boolean isClientSide() { return FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT; }
// }


// Path: src/main/java/com/zalthonethree/zombieinfection/handler/PacketHandler.java
import io.netty.channel.ChannelFutureListener;
import java.util.EnumMap;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.Packet;
import net.minecraft.network.play.INetHandlerPlayClient;
import net.minecraftforge.fml.common.network.FMLEmbeddedChannel;
import net.minecraftforge.fml.common.network.FMLOutboundHandler;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import com.zalthonethree.zombieinfection.handler.foodchange.ZIFoodChangeMessage;
import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessage;
import com.zalthonethree.zombieinfection.handler.timeinfected.ZITimeInfectedMessageHandler;
import com.zalthonethree.zombieinfection.utility.Utilities;

package com.zalthonethree.zombieinfection.handler;





public enum PacketHandler {
	INSTANCE;
	
	private EnumMap<Side, FMLEmbeddedChannel> channels;
	
	private PacketHandler() {
		this.channels = NetworkRegistry.INSTANCE.newChannel("ZombieInfection", new ZombieInfectionCodec());
		if (Utilities.isClientSide()) addClientHandler();
		if (Utilities.isServerSide()) addServerHandler();
	}
	
	@SideOnly(Side.CLIENT) private void addClientHandler() {
		FMLEmbeddedChannel clientChannel = this.channels.get(Side.CLIENT);
		
		String codecName = clientChannel.findChannelHandlerNameForType(ZombieInfectionCodec.class);
		clientChannel.pipeline().addAfter(codecName, "ZITimeInfectedHandler", new ZITimeInfectedMessageHandler());
	}
	
	@SideOnly(Side.SERVER) private void addServerHandler() {
		// FMLEmbeddedChannel serverChannel = this.channels.get(Side.SERVER);
		
		// String codecName = serverChannel.findChannelHandlerNameForType(ZombieInfectionCodec.class);
		// Add any messages that the server gets from the client. Shouldn't really be needed. Uncomment lines above if this is needed.
	}
	
	@SuppressWarnings("unchecked") public static Packet<INetHandlerPlayClient> getTimeInfectedUpdatePacket(int Seconds) {
		ZITimeInfectedMessage msg = new ZITimeInfectedMessage();
		msg.index = 0;
		msg.secondsInfected = Seconds;
		
		return (Packet<INetHandlerPlayClient>) INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
	}
	
	@SuppressWarnings("unchecked") public static Packet<INetHandlerPlayClient> getFoodChangePacket(int food, float saturation) {
		ZIFoodChangeMessage msg = new ZIFoodChangeMessage();
		msg.index = 1;
		msg.foodLevelChange = food;