Examples of FMLProxyPacket


Examples of cpw.mods.fml.common.network.internal.FMLProxyPacket

    public void onClientPacket(ClientCustomPacketEvent event)
    {
        // This method receives the TerrainControl packet with the custom
        // biome colors and weather.

        FMLProxyPacket receivedPacket = event.packet;

        // We're on the client, receive the packet
        ByteBuf stream = receivedPacket.payload();
        try
        {
            int serverProtocolVersion = stream.readInt();
            int clientProtocolVersion = PluginStandardValues.ProtocolVersion;
            if (serverProtocolVersion == clientProtocolVersion)
View Full Code Here

Examples of cpw.mods.fml.common.network.internal.FMLProxyPacket

        if (byteBuf.readableBytes() > 32000 || (type & 0x80) != 0)
            do_compress();

        //FML packet impl returns the whole of the backing array, copy used portion of array to another ByteBuf
        return new FMLProxyPacket(byteBuf.copy(), channel);
    }
View Full Code Here

Examples of cpw.mods.fml.common.network.internal.FMLProxyPacket

    byte discriminator = (byte) packets.indexOf(cl);
    encodedData.writeByte(discriminator);
    //Get the packet class to encode our packet
    msg.encodeInto(ctx, encodedData);
    //Convert our packet into a Forge packet to get it through the Netty system
    FMLProxyPacket proxyPacket = new FMLProxyPacket(encodedData.copy(), ctx.channel().attr(NetworkRegistry.FML_CHANNEL).get());
    //Add our packet to the outgoing packet queue
    out.add(proxyPacket);
  }
View Full Code Here

Examples of cpw.mods.fml.common.network.internal.FMLProxyPacket

      throw new NullPointerException("No Packet Registered for: " + msg.getClass().getCanonicalName());
    }
    byte discriminator = (byte) this.packets.indexOf(packetClass);
    buffer.writeByte(discriminator);
    msg.encodeInto(ctx, buffer);
    FMLProxyPacket proxyPacket = new FMLProxyPacket(buffer.copy(), ctx.channel().attr(NetworkRegistry.FML_CHANNEL).get());
    out.add(proxyPacket);
  }
View Full Code Here

Examples of cpw.mods.fml.common.network.internal.FMLProxyPacket

      writeData(data);
    } catch (IOException e) {
      e.printStackTrace();
    }

    return new FMLProxyPacket(Unpooled.wrappedBuffer(bytes.toByteArray()), channel);
  }
View Full Code Here

Examples of cpw.mods.fml.common.network.internal.FMLProxyPacket

  private static FMLProxyPacket toFMLPacket(ModernPacket msg, String channel) throws Exception {
    ByteBuf buffer = Unpooled.buffer();
    buffer.writeShort(msg.getId());
    buffer.writeInt(msg.getDebugId());
    msg.writeData(new LPDataOutputStream(buffer));
    return new FMLProxyPacket(buffer.copy(), channel);
  }
View Full Code Here

Examples of cpw.mods.fml.common.network.internal.FMLProxyPacket

  }

  @Override
  protected final void encode(ChannelHandlerContext ctx, ModernPacket msg, List<Object> out) throws Exception
  {
    FMLProxyPacket proxy = toFMLPacket(msg, ctx.channel().attr(NetworkRegistry.FML_CHANNEL).get());
    FMLProxyPacket old = ctx.attr(INBOUNDPACKETTRACKER).get().get();
    if (old != null)
    {
      proxy.setDispatcher(old.getDispatcher());
    }
    out.add(proxy);
  }
View Full Code Here

Examples of cpw.mods.fml.common.network.internal.FMLProxyPacket

  public FMLProxyPacket getProxy()
  {
    if ( p.array().length > 2 * 1024 * 1024 ) // 2k walking room :)
      throw new IllegalArgumentException( "Sorry AE2 made a " + p.array().length + " byte packet by accident!" );

    FMLProxyPacket pp = new FMLProxyPacket( p, NetworkHandler.instance.getChannel() );

    if ( AEConfig.instance.isFeatureEnabled( AEFeature.PacketLogging ) )
      AELog.info( getClass().getName() + " : " + pp.payload().readableBytes() );

    return pp;
  }
View Full Code Here

Examples of cpw.mods.fml.common.network.internal.FMLProxyPacket

            data.writeByte(getID());
            writeData(data);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return new FMLProxyPacket(Unpooled.wrappedBuffer(bytes.toByteArray()), CHANNEL_NAME);
    }
View Full Code Here

Examples of cpw.mods.fml.common.network.internal.FMLProxyPacket

        }

        byte discriminator = (byte) this.packets.indexOf(clazz);
        buffer.writeByte(discriminator);
        msg.encodeInto(ctx, buffer);
        FMLProxyPacket proxyPacket = new FMLProxyPacket(buffer.copy(), ctx.channel().attr(NetworkRegistry.FML_CHANNEL).get());
        out.add(proxyPacket);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.