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