    001package cpw.mods.fml.common.modloader;
    002
    003import net.minecraft.entity.player.EntityPlayerMP;
    004import net.minecraft.network.INetworkManager;
    005import net.minecraft.network.packet.Packet250CustomPayload;
    006import cpw.mods.fml.common.network.IPacketHandler;
    007import cpw.mods.fml.common.network.Player;
    008
    009public class ModLoaderPacketHandler implements IPacketHandler
    010{
    011    private BaseModProxy mod;
    012
    013    public ModLoaderPacketHandler(BaseModProxy mod)
    014    {
    015        this.mod = mod;
    016    }
    017
    018    @Override
    019    public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
    020    {
    021        if (player instanceof EntityPlayerMP)
    022        {
    023            mod.serverCustomPayload(((EntityPlayerMP)player).playerNetServerHandler, packet);
    024        }
    025        else
    026        {
    027            ModLoaderHelper.sidedHelper.sendClientPacket(mod, packet);
    028        }
    029    }
    030
    031}