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);
}
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));
}
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);
}
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);
}
Aggregations