public class WirePacket extends Object
| Constructor and Description |
|---|
WirePacket(int id,
byte[] bytes)
Constructs a new WirePacket with a given id and contents
|
WirePacket(PacketType type,
byte[] bytes)
Constructs a new WirePacket with a given type and contents
|
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
bytesFromPacket(PacketContainer packet)
Creates a byte array from an existing PacketContainer containing all the
bytes from that packet
|
boolean |
equals(Object obj) |
static WirePacket |
fromPacket(Object packet)
Creates a WirePacket from an existing Minecraft packet
|
static WirePacket |
fromPacket(PacketContainer packet)
Creates a WirePacket from an existing PacketContainer
|
byte[] |
getBytes()
Gets this packet's contents as a byte array
|
int |
getId()
Gets this packet's ID
|
int |
hashCode() |
static int |
readVarInt(io.netty.buffer.ByteBuf input) |
io.netty.buffer.ByteBuf |
serialize()
Serializes this packet into a byte buffer
|
String |
toString() |
void |
writeBytes(io.netty.buffer.ByteBuf output)
Writes the contents of this packet to a given output
|
void |
writeFully(io.netty.buffer.ByteBuf output)
Fully writes the ID and contents of this packet to a given output
|
void |
writeId(io.netty.buffer.ByteBuf output)
Writes the id of this packet to a given output
|
static void |
writeVarInt(io.netty.buffer.ByteBuf output,
int i) |
public WirePacket(PacketType type, byte[] bytes)
type - Type of the packetbytes - Contents of the packetpublic WirePacket(int id,
byte[] bytes)
id - ID of the packetbytes - Contents of the packetpublic int getId()
public byte[] getBytes()
public void writeId(io.netty.buffer.ByteBuf output)
output - Output to write topublic void writeBytes(io.netty.buffer.ByteBuf output)
output - Output to write topublic void writeFully(io.netty.buffer.ByteBuf output)
output - Output to write topublic io.netty.buffer.ByteBuf serialize()
public static WirePacket fromPacket(PacketContainer packet)
packet - Existing packetpublic static byte[] bytesFromPacket(PacketContainer packet)
packet - Existing packetpublic static WirePacket fromPacket(Object packet)
packet - Existing Minecraft packetIllegalArgumentException - If the packet is null or not a Minecraft packetpublic static void writeVarInt(io.netty.buffer.ByteBuf output,
int i)
public static int readVarInt(io.netty.buffer.ByteBuf input)
Copyright © 2012–2017 Comphenix and dmulloy2. Licensed under the GNU GPL v2.