Class PacketWriting
java.lang.Object
net.minestom.server.network.packet.PacketWriting
Tools to write packets into a
NetworkBuffer
for network processing.
Fairly internal and performance sensitive.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic NetworkBuffer
allocateTrimmedPacket
(@NotNull ConnectionState state, @NotNull ClientPacket packet, int compressionThreshold) static NetworkBuffer
allocateTrimmedPacket
(@NotNull ConnectionState state, @NotNull ServerPacket packet, int compressionThreshold) static <T> NetworkBuffer
allocateTrimmedPacket
(@NotNull NetworkBuffer tmpBuffer, @NotNull PacketParser<T> parser, @NotNull ConnectionState state, T packet, int compressionThreshold) static <T> NetworkBuffer
allocateTrimmedPacket
(@NotNull NetworkBuffer tmpBuffer, @NotNull PacketRegistry<T> registry, T packet, int compressionThreshold) static <T> NetworkBuffer
allocateTrimmedPacket
(@NotNull PacketParser<T> parser, @NotNull ConnectionState state, T packet, int compressionThreshold) static void
writeFramedPacket
(@NotNull NetworkBuffer buffer, @NotNull ConnectionState state, @NotNull ClientPacket packet, int compressionThreshold) static void
writeFramedPacket
(@NotNull NetworkBuffer buffer, @NotNull ConnectionState state, @NotNull ServerPacket packet, int compressionThreshold) static <T> void
writeFramedPacket
(@NotNull NetworkBuffer buffer, NetworkBuffer.Type<T> type, int id, T packet, int compressionThreshold) static <T> void
writeFramedPacket
(@NotNull NetworkBuffer buffer, @NotNull PacketParser<T> parser, @NotNull ConnectionState state, T packet, int compressionThreshold) static <T> void
writeFramedPacket
(@NotNull NetworkBuffer buffer, @NotNull PacketRegistry<T> registry, T packet, int compressionThreshold) static <T> void
writeFramedPacket
(@NotNull NetworkBuffer buffer, PacketRegistry.PacketInfo<T> packetInfo, T packet, int compressionThreshold) static <T> void
writeQueue
(NetworkBuffer buffer, Queue<T> queue, int minWrite, BiPredicate<NetworkBuffer, T> writer)
-
Constructor Details
-
PacketWriting
public PacketWriting()
-
-
Method Details
-
writeFramedPacket
public static void writeFramedPacket(@NotNull @NotNull NetworkBuffer buffer, @NotNull @NotNull ConnectionState state, @NotNull @NotNull ClientPacket packet, int compressionThreshold) throws IndexOutOfBoundsException - Throws:
IndexOutOfBoundsException
-
writeFramedPacket
public static void writeFramedPacket(@NotNull @NotNull NetworkBuffer buffer, @NotNull @NotNull ConnectionState state, @NotNull @NotNull ServerPacket packet, int compressionThreshold) throws IndexOutOfBoundsException - Throws:
IndexOutOfBoundsException
-
writeFramedPacket
public static <T> void writeFramedPacket(@NotNull @NotNull NetworkBuffer buffer, @NotNull @NotNull PacketParser<T> parser, @NotNull @NotNull ConnectionState state, @NotNull T packet, int compressionThreshold) throws IndexOutOfBoundsException - Throws:
IndexOutOfBoundsException
-
writeFramedPacket
public static <T> void writeFramedPacket(@NotNull @NotNull NetworkBuffer buffer, @NotNull @NotNull PacketRegistry<T> registry, @NotNull T packet, int compressionThreshold) throws IndexOutOfBoundsException - Throws:
IndexOutOfBoundsException
-
writeFramedPacket
public static <T> void writeFramedPacket(@NotNull @NotNull NetworkBuffer buffer, @NotNull PacketRegistry.PacketInfo<T> packetInfo, @NotNull T packet, int compressionThreshold) throws IndexOutOfBoundsException - Throws:
IndexOutOfBoundsException
-
writeFramedPacket
public static <T> void writeFramedPacket(@NotNull @NotNull NetworkBuffer buffer, @NotNull NetworkBuffer.Type<T> type, int id, @NotNull T packet, int compressionThreshold) throws IndexOutOfBoundsException - Throws:
IndexOutOfBoundsException
-
allocateTrimmedPacket
public static NetworkBuffer allocateTrimmedPacket(@NotNull @NotNull ConnectionState state, @NotNull @NotNull ClientPacket packet, int compressionThreshold) -
allocateTrimmedPacket
public static NetworkBuffer allocateTrimmedPacket(@NotNull @NotNull ConnectionState state, @NotNull @NotNull ServerPacket packet, int compressionThreshold) -
allocateTrimmedPacket
public static <T> NetworkBuffer allocateTrimmedPacket(@NotNull @NotNull PacketParser<T> parser, @NotNull @NotNull ConnectionState state, @NotNull T packet, int compressionThreshold) -
allocateTrimmedPacket
public static <T> NetworkBuffer allocateTrimmedPacket(@NotNull @NotNull NetworkBuffer tmpBuffer, @NotNull @NotNull PacketParser<T> parser, @NotNull @NotNull ConnectionState state, @NotNull T packet, int compressionThreshold) -
allocateTrimmedPacket
public static <T> NetworkBuffer allocateTrimmedPacket(@NotNull @NotNull NetworkBuffer tmpBuffer, @NotNull @NotNull PacketRegistry<T> registry, @NotNull T packet, int compressionThreshold) -
writeQueue
public static <T> void writeQueue(NetworkBuffer buffer, Queue<T> queue, int minWrite, BiPredicate<NetworkBuffer, T> writer)
-