    001    package cpw.mods.fml.common.modloader;
    002
    003    import net.minecraft.entity.player.EntityPlayerMP;
    004    import net.minecraft.network.INetworkManager;
    005    import net.minecraft.network.packet.Packet250CustomPayload;
    006    import cpw.mods.fml.common.network.IPacketHandler;
    007    import cpw.mods.fml.common.network.Player;
    008
    009    public 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    }