Java 类net.minecraft.network.INetworkManager 实例源码

项目:ZeroQuest    文件:RemoteKeyPacketHandler.java   
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) {
    if (player instanceof EntityPlayerMP) {
        EntityPlayerMP playerMP = (EntityPlayerMP) player;
        RemoteKey rk = new RemoteKey(packet);

        Map<String, Boolean> playerKeyMap;
        if (!playerKeys.containsKey(playerMP.username)) {
            playerKeyMap = new HashMap<String, Boolean>();
            playerKeys.put(playerMP.username, playerKeyMap);
        } else {
            playerKeyMap = playerKeys.get(playerMP.username);
        }
        playerKeyMap.put(rk.getName(), rk.isDown());
    }
}
项目:Billund    文件:TileEntityBillund.java   
@Override
public void onDataPacket( INetworkManager net, Packet132TileEntityData packet )
{
    switch( packet.actionType )
    {
        case 0:
        {
            this.readFromNBT( packet.data );
worldObj.markBlockForUpdate( xCoord, yCoord, zCoord );
            break;
        }
        default:
        {
            break;
        }
    }
}
项目:forge_world_downloader    文件:WDLConnectionHandler.java   
@Override
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager)
{
    System.out.println("Hello !");
    if (netClientHandler instanceof NetClientHandler)
    {
        NetClientHandler nch = (NetClientHandler) netClientHandler;
        INetworkManager netmanager = nch.getNetManager();

        System.out.println("Hello 2 !");

        if (netmanager instanceof TcpConnection)
        {
            System.out.println("Hello 3 !");
            ((TcpConnection) netmanager).setNetHandler(new WDLNetClientHandler(nch));
        }
    }
}
项目:Rediscovered-Mod-1.6.4    文件:ServerPacketHandler.java   
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
{
    EntityPlayer sender = (EntityPlayer) player;

    if (packet.channel.equals(Resources.PACKET_CHANNEL))
    {
        DataInputStream data = new DataInputStream(new ByteArrayInputStream(packet.data));
        int id = -1;

        try
        {
            id = data.readInt();

        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
    }
}
项目:Rediscovered-Mod-1.6.4    文件:ClientPacketHandler.java   
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
{
    if (packet.channel.equals(Resources.PACKET_CHANNEL))
    {
        DataInputStream data = new DataInputStream(new ByteArrayInputStream(packet.data));

        try
        {
            int id = -1;
            id = data.readInt();
            EntityPlayer p = (EntityPlayer) player;

        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
    }
}
项目:RuneCraftery    文件:ModIdMapPacket.java   
@Override
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
    byte[] allData = Bytes.concat(partials);
    GameData.initializeServerGate(1);
    try
    {
        NBTTagCompound serverList = CompressedStreamTools.func_74792_a(allData);
        NBTTagList list = serverList.func_74761_m("List");
        Set<ItemData> itemData = GameData.buildWorldItemData(list);
        GameData.validateWorldSave(itemData);
        MapDifference<Integer, ItemData> serverDifference = GameData.gateWorldLoadingForValidation();
        if (serverDifference!=null)
        {
            FMLCommonHandler.instance().disconnectIDMismatch(serverDifference, netHandler, network);

        }
    }
    catch (IOException e)
    {
    }
}
项目:RuneCraftery    文件:EntitySpawnPacket.java   
@Override
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
    NetworkModHandler nmh = handler.findNetworkModHandler(networkId);
    ModContainer mc = nmh.getContainer();

    EntityRegistration registration = EntityRegistry.instance().lookupModSpawn(mc, modEntityId);
    if (registration == null || registration.getEntityClass() == null)
    {
        FMLLog.log(Level.WARNING, "Missing mod entity information for %s : %d", mc.getModId(), modEntityId);
        return;
    }


    Entity entity = FMLCommonHandler.instance().spawnEntityIntoClientWorld(registration, this);
}
项目:UniversalCoinsMod    文件:UCPacketHandler.java   
@Override
public void onPacketData(INetworkManager manager,
        Packet250CustomPayload packet, Player player) {
    if (packet.channel.equals("UCTS_TileEntity")) {
        handleTEPacket(manager, packet, player);
    }
    else if (packet.channel.equals("UCTS_Buttons")) {
        handleButtonsPacket(manager, packet, player);
    }
    else if (packet.channel.equals("UCTS_TE_Request")){
        handleTERequest(manager, packet, player);
    }
}
项目:UniversalCoinsMod    文件:UCPacketHandler.java   
private void handleTERequest(INetworkManager manager, Packet250CustomPayload packet, Player player) {
    // Packet always player-to-server
    EntityPlayer entityPlayer = (EntityPlayer) player;
    World world = entityPlayer.worldObj;
    if (world.isRemote) {
        Minecraft.getMinecraft().getLogAgent()
                .logWarning("UniversalCoins: TE Request packet received by client.");
    }
    int x = 0, y = 0, z = 0, dimension;
    DataInputStream stream = new DataInputStream(new ByteArrayInputStream(
            packet.data));
    try {
        x = stream.readInt();
        y = stream.readInt();
        z = stream.readInt();
        dimension = stream.readInt();
    } catch (Exception ex) {
        ex.printStackTrace();
        return;
    }
    if (world.getWorldInfo().getVanillaDimension() != dimension) {
        return;
    }
    TileEntity tEntity = world.getBlockTileEntity(x, y, z);
    if (tEntity != null && tEntity instanceof UCTileEntity) {
        UCTileEntity ucTileEntity = (UCTileEntity) tEntity;
        ucTileEntity.dispatchPackage();
    }

}
项目:CcmBurialServicesInc    文件:GraveTE.java   
public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt)
{
    NBTTagList nbttaglist = pkt.data.getTagList("contents");
    contents = new ItemStack[nbttaglist.tagCount()];
    for (int i = 0; i < nbttaglist.tagCount(); ++i)
    {
        contents[i] = ItemStack.loadItemStackFromNBT((NBTTagCompound) nbttaglist.tagAt(i));
    }
    username = pkt.data.getString("username");
    holding = ItemStack.loadItemStackFromNBT(pkt.data.getCompoundTag("holding"));
    text = pkt.data.getString("text").split("\n");
    age = pkt.data.getInteger("age");
}
项目:Billund    文件:PacketHandler.java   
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload _packet, Player player) 
{
    try
    {
        BillundPacket packet = BillundPacket.parse( _packet.data );
        Billund.handlePacket( packet, player );
    }
    catch( Exception e )
    {
        // Something failed, ignore it
        //e.printStackTrace();
    }   
}
项目:FantasyCraft-Mod    文件:PacketHandler.java   
@Override
public void onPacketData(INetworkManager manager,
        Packet250CustomPayload packet, Player player) {

    DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));
    byte packetType;


    try {
        packetType = inputStream.readByte();
    } catch (IOException e) {
        e.printStackTrace();
        return;
    }

    if(packet.channel.equals("GenericClass")){
        switch(packetType) {
        case EXTENDED_PROPERTIES: handleClass(packet, player, inputStream); break;
        case OPEN_SERVER_GUI: handleOpenServerGui(packet, (EntityPlayer) player, inputStream); break;
        case EXTENDED_SPEC: handleSpec(packet, player, inputStream); break;
        case EXTENDED_WEAPONS: handleWeapon(packet, player, inputStream); break;
        case EXTENDED_STATS: handleStats(packet, player, inputStream); break;
        case EXTENDED_CHAIN: handleChain(packet, player, inputStream); break;
        default: System.out.println("[PACKET][WARNING] Unknown packet type " + packetType);
        }
    }
}
项目:Package    文件:TileCore.java   
@Override
public void onDataPacket(INetworkManager manager, Packet132TileEntityData packet) {
    switch (packet.actionType) {
        case DATA_CLIENT:
            readFromNBT(packet.data);
            break;
        case DATA_POKE:
            onPoke();
            break;
        case DATA_DATA:
            onData(packet.data);
            break;
    }
}
项目:RuneCraftery    文件:DimensionRegisterPacket.java   
@Override
public void execute(INetworkManager network, EntityPlayer player)
{
    if (!(player instanceof EntityPlayerMP))
    {
        if (!DimensionManager.isDimensionRegistered(dimensionId))
        {
            DimensionManager.registerDimension(dimensionId, providerId);
        }
    }
}
项目:RuneCraftery    文件:ForgePacket.java   
private ForgePacket consumePart(INetworkManager network, byte[] data)
{
    if (partTracker == null)
    {
        partTracker = new MapMaker().weakKeys().weakValues().makeMap();
    }
    if (!partTracker.containsKey(network))
    {
        partTracker.put(network, make());
    }

    ForgePacket pkt = partTracker.get(network);

    ByteArrayDataInput bdi = ByteStreams.newDataInput(data);
    int chunkIdx = UnsignedBytes.toInt(bdi.readByte());
    int chunkTotal = UnsignedBytes.toInt(bdi.readByte());
    int chunkLength = bdi.readInt();

    if (pkt.partials == null)
    {
        pkt.partials = new byte[chunkTotal][];
    }

    pkt.partials[chunkIdx] = new byte[chunkLength];
    bdi.readFully(pkt.partials[chunkIdx]);
    for (int i = 0; i < pkt.partials.length; i++)
    {
        if (pkt.partials[i] == null)
        {
            return null;
        }
    }

    return pkt;
}
项目:RuneCraftery    文件:BaseMod.java   
/**
 * Called when a client logs out of the server.
 *
 * NOTE: this method is not provided in Risugami's implementation of BaseMod!
 */
@Override
@Deprecated
public void onClientLogout(INetworkManager mgr)
{

}
项目:Rediscovered-Mod-1.6.4    文件:PacketHandler.java   
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) {
    if(packet.channel.equals("RediscoveredMod")){
        handlePacket(packet);
    }

}
项目:RuneCraftery    文件:FMLClientHandler.java   
@Override
public void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr)
{
    boolean criticalMismatch = !s.entriesOnlyOnLeft().isEmpty();
    for (Entry<Integer, ValueDifference<ItemData>> mismatch : s.entriesDiffering().entrySet())
    {
        ValueDifference<ItemData> vd = mismatch.getValue();
        if (!vd.leftValue().mayDifferByOrdinal(vd.rightValue()))
        {
            criticalMismatch = true;
        }
    }

    if (!criticalMismatch)
    {
        // We'll carry on with this connection, and just log a message instead
        return;
    }
    // Nuke the connection
    ((NetClientHandler)toKill).func_72553_e();
    // Stop GuiConnecting
    GuiConnecting.forceTermination((GuiConnecting)client.field_71462_r);
    // pulse the network manager queue to clear cruft
    mgr.func_74428_b();
    // Nuke the world client
    client.func_71403_a((WorldClient)null);
    // Show error screen
    warnIDMismatch(s, false);
}
项目:RuneCraftery    文件:ModLoaderClientHelper.java   
@Override
public boolean clientConnectionClosed(INetworkManager manager, BaseModProxy mod)
{
    if (managerLookups.containsKey(manager))
    {
        ((BaseMod)mod).clientDisconnect((NetClientHandler) managerLookups.get(manager));
        return true;
    }
    return false;
}
项目:RuneCraftery    文件:BaseMod.java   
/**
 * Called when a client logs out of the server.
 *
 * NOTE: this method is not provided in Risugami's implementation of BaseMod!
 */
@Override
@Deprecated
public void onClientLogout(INetworkManager mgr)
{

}
项目:RuneCraftery    文件:ForgeConnectionHandler.java   
@Override
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager)
{
    Packet250CustomPayload[] fluidPackets = ForgePacket.makePacketSet(new FluidIdMapPacket());
    for (int i = 0; i < fluidPackets.length; i++) {
        PacketDispatcher.sendPacketToPlayer(fluidPackets[i], player);
    }
}
项目:RuneCraftery    文件:FMLPacket.java   
private FMLPacket findCurrentPart(INetworkManager network)
{
    if (partTracker == null)
    {
        partTracker = new MapMaker().weakKeys().weakValues().makeMap();
    }
    if (!partTracker.containsKey(network))
    {
        partTracker.put(network, make());
    }
    return partTracker.get(network);
}
项目:RuneCraftery    文件:OpenGuiPacket.java   
@Override
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
    EntityPlayer player = netHandler.getPlayer();
    player.openGui(networkId, modGuiId, player.field_70170_p, x, y, z);
    player.field_71070_bA.field_75152_c = windowId;
}
项目:RuneCraftery    文件:ModIdentifiersPacket.java   
@Override
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
    for (Entry<String,Integer> idEntry : modIds.entrySet())
    {
        handler.bindNetworkId(idEntry.getKey(), idEntry.getValue());
    }
    // TODO other id maps
}
项目:RuneCraftery    文件:DimensionRegisterPacket.java   
@Override
public void execute(INetworkManager network, EntityPlayer player)
{
    if (!(player instanceof EntityPlayerMP))
    {
        if (!DimensionManager.isDimensionRegistered(dimensionId))
        {
            DimensionManager.registerDimension(dimensionId, providerId);
        }
    }
}
项目:ForestryLegacy    文件:PacketHandlerMail.java   
@Override
public void onPacketData(INetworkManager network, int packetID, DataInputStream data, Player player) {

    try {

        PacketUpdate packet;
        switch (packetID) {
        case PacketIds.TRADING_INFO:
            PacketTradeInfo packetT = new PacketTradeInfo();
            packetT.readData(data);
            onTradeInfo(packetT);
            break;
        case PacketIds.POBOX_INFO:
            PacketPOBoxInfo packetP = new PacketPOBoxInfo();
            packetP.readData(data);
            onPOBoxInfo(packetP);
            break;
        case PacketIds.LETTER_RECIPIENT:
            packet = new PacketUpdate();
            packet.readData(data);
            onLetterRecipient((EntityPlayer) player, packet);
            break;
        case PacketIds.LETTER_TEXT:
            packet = new PacketUpdate();
            packet.readData(data);
            onLetterText((EntityPlayer) player, packet);
            break;
        case PacketIds.TRADING_MONIKER_SET:
            packet = new PacketUpdate();
            packet.readData(data);
            onMonikerSet((EntityPlayer) player, packet);
            break;
        case PacketIds.POBOX_INFO_REQUEST:
            onPOBoxInfoRequest((EntityPlayer) player);
            break;
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
项目:ForestryLegacy    文件:PacketHandlerPipes.java   
@Override
public void onPacketData(INetworkManager network, int packetID, DataInputStream data, Player player) {

    try {

        PacketUpdate packetU;

        switch (packetID) {

        // CLIENT
        case PacketIds.PROP_SEND_FILTER_SET:
            PacketNBT packetN = new PacketNBT();
            packetN.readData(data);
            onFilterSet(packetN);
            break;

        // SERVER
        case PacketIds.PROP_REQUEST_FILTER_SET:
            PacketCoordinates packetC = new PacketCoordinates();
            packetC.readData(data);
            onRequestFilterSet((EntityPlayer) player, packetC);
            break;
        case PacketIds.PROP_SEND_FILTER_CHANGE_TYPE:
            packetU = new PacketUpdate();
            packetU.readData(data);
            onTypeFilterChange((EntityPlayer) player, packetU);
            break;
        case PacketIds.PROP_SEND_FILTER_CHANGE_GENOME:
            packetU = new PacketUpdate();
            packetU.readData(data);
            onGenomeFilterChange((EntityPlayer) player, packetU);
            break;

        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
项目:RuneCraftery    文件:ModLoaderConnectionHandler.java   
@Override
public void connectionClosed(INetworkManager manager)
{
    if (ModLoaderHelper.sidedHelper==null || !ModLoaderHelper.sidedHelper.clientConnectionClosed(manager, mod))
    {
        mod.serverDisconnect();
        mod.onClientLogout(manager);
    }
}
项目:RuneCraftery    文件:NetServerHandler.java   
public NetServerHandler(MinecraftServer p_i1530_1_, INetworkManager p_i1530_2_, EntityPlayerMP p_i1530_3_) {
   this.field_72573_d = p_i1530_1_;
   this.field_72575_b = p_i1530_2_;
   p_i1530_2_.func_74425_a(this);
   this.field_72574_e = p_i1530_3_;
   p_i1530_3_.field_71135_a = this;
}
项目:RuneCraftery    文件:ForgeConnectionHandler.java   
@Override
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager)
{
    Packet250CustomPayload[] fluidPackets = ForgePacket.makePacketSet(new FluidIdMapPacket());
    for (int i = 0; i < fluidPackets.length; i++) {
        PacketDispatcher.sendPacketToPlayer(fluidPackets[i], player);
    }
}
项目:RuneCraftery    文件:FMLClientHandler.java   
@Override
public void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr)
{
    boolean criticalMismatch = !s.entriesOnlyOnLeft().isEmpty();
    for (Entry<Integer, ValueDifference<ItemData>> mismatch : s.entriesDiffering().entrySet())
    {
        ValueDifference<ItemData> vd = mismatch.getValue();
        if (!vd.leftValue().mayDifferByOrdinal(vd.rightValue()))
        {
            criticalMismatch = true;
        }
    }

    if (!criticalMismatch)
    {
        // We'll carry on with this connection, and just log a message instead
        return;
    }
    // Nuke the connection
    ((NetClientHandler)toKill).disconnect();
    // Stop GuiConnecting
    GuiConnecting.forceTermination((GuiConnecting)client.currentScreen);
    // pulse the network manager queue to clear cruft
    mgr.processReadPackets();
    // Nuke the world client
    client.loadWorld((WorldClient)null);
    // Show error screen
    warnIDMismatch(s, false);
}
项目:RuneCraftery    文件:FMLPacket.java   
private FMLPacket findCurrentPart(INetworkManager network)
{
    if (partTracker == null)
    {
        partTracker = new MapMaker().weakKeys().weakValues().makeMap();
    }
    if (!partTracker.containsKey(network))
    {
        partTracker.put(network, make());
    }
    return partTracker.get(network);
}
项目:RuneCraftery    文件:FMLPacket.java   
public static FMLPacket readPacket(INetworkManager network, byte[] payload)
{
    int type = UnsignedBytes.toInt(payload[0]);
    Type eType = Type.values()[type];
    FMLPacket pkt;
    if (eType.isMultipart())
    {
        pkt = eType.findCurrentPart(network);
    }
    else
    {
        pkt = eType.make();
    }
    return pkt.consumePacket(Arrays.copyOfRange(payload, 1, payload.length));
}
项目:RuneCraftery    文件:OpenGuiPacket.java   
@Override
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
    EntityPlayer player = netHandler.getPlayer();
    player.openGui(networkId, modGuiId, player.worldObj, x, y, z);
    player.openContainer.windowId = windowId;
}
项目:RuneCraftery    文件:ModIdentifiersPacket.java   
@Override
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
    for (Entry<String,Integer> idEntry : modIds.entrySet())
    {
        handler.bindNetworkId(idEntry.getKey(), idEntry.getValue());
    }
    // TODO other id maps
}
项目:OldMods    文件:ToggleableMobSpawnerTileEntity.java   
@Override
   public void onDataPacket( INetworkManager net, Packet132TileEntityData packet )
{
    readFromNBT( packet.data );
}
项目:MC-MineAPI.Java    文件:CustomConnectionHandler.java   
@Override
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager)
{
}
项目:MC-MineAPI.Java    文件:CustomConnectionHandler.java   
@Override
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
{
    return null;
}
项目:MC-MineAPI.Java    文件:CustomConnectionHandler.java   
@Override
public void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager)
{
}