package openmods.network.event;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.Collection;
import java.util.List;

import net.minecraft.entity.player.EntityPlayer;

import com.google.common.collect.Lists;

import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.network.handshake.NetworkDispatcher;

public abstract class EventPacket extends Event {

	final List<EventPacket> replies = Lists.newArrayList();

	NetworkDispatcher dispatcher;

	protected abstract void readFromStream(DataInput input) throws IOException;

	protected abstract void writeToStream(DataOutput output) throws IOException;

	protected void appendLogInfo(List<String> info) {}

	protected boolean checkSendToClient() {
		// if (!getType().getDirection().toClient) {
		// Log.warn("Trying to sent message '%s' to client", this);
		// return false;
		// }
		return true;
	}

	protected boolean checkSendToServer() {
		// if (!getType().getDirection().toServer) {
		// Log.warn("Trying to sent message '%s' to server", this);
		// return false;
		// }
		return true;
	}

	public void reply(EventPacket reply) {
		reply.dispatcher = dispatcher;
		this.replies.add(reply);
	}

	public void sendToPlayer(EntityPlayer player) {
		// sendToPlayer((Player)player);
	}

	public void sendToPlayers(Collection<EntityPlayer> players) {
		// if (checkSendToClient()) {
		// for (Packet packet : EventPacketManager.serializeEvent(this))
		// for (EntityPlayer player : players)
		// OpenMods.proxy.sendPacketToPlayer((Player)player, packet);
		// }
	}

	public void sendToServer() {
		// if (checkSendToServer()) {
		// for (Packet packet : EventPacketManager.serializeEvent(this))
		// OpenMods.proxy.sendPacketToServer(packet);
		// }
	}
}

@@ -128,91 +128,12 @@
 til.
-Collection;%0Aimport java.util.List;%0A%0Aimport net.minecraft.entity.player.EntityPlayer
+List
 ;%0A%0Ai
@@ -641,1049 +641,105 @@
 %0A%0A%09p
-rotected boolean checkSendToClient() %7B%0A%09%09// if (!getType().getDirection().toClient) %7B%0A%09%09// Log.warn(%22Trying to sent message '%25s' to client%22, this);%0A%09%09// return false;%0A%09%09// %7D%0A%09%09return true;%0A%09%7D%0A%0A%09protected boolean checkSendToServer() %7B%0A%09%09// if (!getType().getDirection().toServer) %7B%0A%09%09// Log.warn(%22Trying to sent message '%25s' to server%22, this);%0A%09%09// return false;%0A%09%09// %7D%0A%09%09return true;%0A%09%7D%0A%0A%09public void reply(EventPacket reply) %7B%0A%09%09reply.dispatcher = dispatcher;%0A%09%09this.replies.add(reply);%0A%09%7D%0A%0A%09public void sendToPlayer(EntityPlayer player) %7B%0A%09%09// sendToPlayer((Player)player);%0A%09%7D%0A%0A%09public void sendToPlayers(Collection%3CEntityPlayer%3E players) %7B%0A%09%09// if (checkSendToClient()) %7B%0A%09%09// for (Packet packet : EventPacketManager.serializeEvent(this))%0A%09%09// for (EntityPlayer player : players)%0A%09%09// OpenMods.proxy.sendPacketToPlayer((Player)player, packet);%0A%09%09// %7D%0A%09%7D%0A%0A%09public void sendToServer() %7B%0A%09%09// if (checkSendToServer()) %7B%0A%09%09// for (Packet packet : EventPacketManager.serializeEvent(this))%0A%09%09// OpenMods.proxy.sendPacketToServer(packet);%0A%09%09// %7D
+ublic void reply(EventPacket reply) %7B%0A%09%09reply.dispatcher = dispatcher;%0A%09%09this.replies.add(reply);
 %0A%09%7D%0A

Remove junk