I use this code buy thePlayer is null
@SubscribeEvent
public void onCLientJoin(FMLNetworkEvent.ClientConnectedToServerEvent e) {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(stream);
try {
out.writeUTF("TO COM O MOD");
} catch (IOException ex) {
ex.printStackTrace();
}
ByteBuf bytebuf = Unpooled.copiedBuffer(stream.toByteArray());
Minecraft.getMinecraft().thePlayer.sendQueue.handleCustomPayload(new S3FPacketCustomPayload("TCMOD", new PacketBuffer(bytebuf)));
System.out.println("Packet Enviado");
}
How a send the packet to the server ?