Search in sources :

Example 1 with FMLProxyPacket

use of cpw.mods.fml.common.network.internal.FMLProxyPacket in project PneumaticCraft by MineMaarten.

the class DescPacketHandler method getPacket.

public static FMLProxyPacket getPacket(PacketDescription packet) {
    ByteBuf buf = Unpooled.buffer();
    packet.toBytes(buf);
    return new FMLProxyPacket(buf, CHANNEL);
}
Also used : FMLProxyPacket(cpw.mods.fml.common.network.internal.FMLProxyPacket) ByteBuf(io.netty.buffer.ByteBuf)

Example 2 with FMLProxyPacket

use of cpw.mods.fml.common.network.internal.FMLProxyPacket in project ArsMagica2 by Mithion.

the class AMNetHandler method sendPacketToAllClientsNear.

public void sendPacketToAllClientsNear(int dimension, double ox, double oy, double oz, double radius, byte packetID, byte[] data) {
    // first byte is ID, followed by data
    byte[] pkt_data = new byte[data.length + 1];
    pkt_data[0] = packetID;
    // copy the data
    for (int i = 0; i < data.length; ++i) {
        pkt_data[i + 1] = data[i];
    }
    FMLProxyPacket packet = new FMLProxyPacket(Unpooled.copiedBuffer(pkt_data), ChannelLabel);
    packet.setTarget(Side.CLIENT);
    Channel.sendToAllAround(packet, new TargetPoint(dimension, ox, oy, oz, radius));
}
Also used : FMLProxyPacket(cpw.mods.fml.common.network.internal.FMLProxyPacket) TargetPoint(cpw.mods.fml.common.network.NetworkRegistry.TargetPoint) TargetPoint(cpw.mods.fml.common.network.NetworkRegistry.TargetPoint)

Example 3 with FMLProxyPacket

use of cpw.mods.fml.common.network.internal.FMLProxyPacket in project ArsMagica2 by Mithion.

the class AMNetHandler method sendPacketToServer.

public void sendPacketToServer(byte packetID, byte[] data) {
    byte[] pkt_data = new byte[data.length + 1];
    // first byte is ID
    pkt_data[0] = packetID;
    // copy the data
    for (int i = 0; i < data.length; ++i) {
        pkt_data[i + 1] = data[i];
    }
    FMLProxyPacket packet = new FMLProxyPacket(Unpooled.copiedBuffer(pkt_data), ChannelLabel);
    packet.setTarget(Side.SERVER);
    Channel.sendToServer(packet);
}
Also used : FMLProxyPacket(cpw.mods.fml.common.network.internal.FMLProxyPacket) TargetPoint(cpw.mods.fml.common.network.NetworkRegistry.TargetPoint)

Example 4 with FMLProxyPacket

use of cpw.mods.fml.common.network.internal.FMLProxyPacket in project ArsMagica2 by Mithion.

the class AMNetHandler method sendPacketToClientPlayer.

public void sendPacketToClientPlayer(EntityPlayerMP player, byte packetID, byte[] data) {
    // first byte is ID, followed by data
    byte[] pkt_data = new byte[data.length + 1];
    pkt_data[0] = packetID;
    // copy the data
    for (int i = 0; i < data.length; ++i) {
        pkt_data[i + 1] = data[i];
    }
    FMLProxyPacket packet = new FMLProxyPacket(Unpooled.copiedBuffer(pkt_data), ChannelLabel);
    packet.setTarget(Side.CLIENT);
    Channel.sendTo(packet, player);
}
Also used : FMLProxyPacket(cpw.mods.fml.common.network.internal.FMLProxyPacket) TargetPoint(cpw.mods.fml.common.network.NetworkRegistry.TargetPoint)

Aggregations

FMLProxyPacket (cpw.mods.fml.common.network.internal.FMLProxyPacket)4 TargetPoint (cpw.mods.fml.common.network.NetworkRegistry.TargetPoint)3 ByteBuf (io.netty.buffer.ByteBuf)1