Package net.minecraftforge.network
Class VanillaPacketSplitter
- java.lang.Object
-
- net.minecraftforge.network.VanillaPacketSplitter
-
public class VanillaPacketSplitter extends java.lang.Object
A custom payload channel that allows sending vanilla server-to-client packets, even if they would normally be too large for the vanilla protocol. This is achieved by splitting them into multiple custom payload packets.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
VanillaPacketSplitter.RemoteCompatibility
-
Field Summary
Fields Modifier and Type Field Description private static ResourceLocation
CHANNEL
private static org.apache.logging.log4j.Logger
LOGGER
private static int
PART_SIZE
private static int
PAYLOAD_TO_CLIENT_MAX
private static int
PROTOCOL_MAX
private static java.util.List<PacketBuffer>
receivedBuffers
private static byte
STATE_FIRST
private static byte
STATE_LAST
private static ResourceLocation
V11_DUMMY_CHANNEL
private static java.lang.String
VERSION
private static java.lang.String
VERSION_11
-
Constructor Summary
Constructors Constructor Description VanillaPacketSplitter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
appendPackets(ProtocolType protocol, PacketDirection direction, IPacket<?> packet, java.util.List<? super IPacket<?>> out)
Append the given packet to the given list.static VanillaPacketSplitter.RemoteCompatibility
getRemoteCompatibility(NetworkManager manager)
private static boolean
heuristicIsDefinitelySmallEnough(IPacket<?> packet)
static boolean
isRemoteCompatible(NetworkManager manager)
private static void
onClientPacket(NetworkEvent.ServerCustomPayloadEvent event)
static void
register()
-
-
-
Field Detail
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER
-
CHANNEL
private static final ResourceLocation CHANNEL
-
V11_DUMMY_CHANNEL
private static final ResourceLocation V11_DUMMY_CHANNEL
-
VERSION
private static final java.lang.String VERSION
- See Also:
- Constant Field Values
-
VERSION_11
private static final java.lang.String VERSION_11
- See Also:
- Constant Field Values
-
PROTOCOL_MAX
private static final int PROTOCOL_MAX
- See Also:
- Constant Field Values
-
PAYLOAD_TO_CLIENT_MAX
private static final int PAYLOAD_TO_CLIENT_MAX
- See Also:
- Constant Field Values
-
PART_SIZE
private static final int PART_SIZE
- See Also:
- Constant Field Values
-
STATE_FIRST
private static final byte STATE_FIRST
- See Also:
- Constant Field Values
-
STATE_LAST
private static final byte STATE_LAST
- See Also:
- Constant Field Values
-
receivedBuffers
private static final java.util.List<PacketBuffer> receivedBuffers
-
-
Method Detail
-
register
public static void register()
-
appendPackets
public static void appendPackets(ProtocolType protocol, PacketDirection direction, IPacket<?> packet, java.util.List<? super IPacket<?>> out)
Append the given packet to the given list. If the packet needs to be split, multiple packets will be appened. Otherwise only the packet itself.
-
heuristicIsDefinitelySmallEnough
private static boolean heuristicIsDefinitelySmallEnough(IPacket<?> packet)
-
onClientPacket
private static void onClientPacket(NetworkEvent.ServerCustomPayloadEvent event)
-
getRemoteCompatibility
public static VanillaPacketSplitter.RemoteCompatibility getRemoteCompatibility(NetworkManager manager)
-
isRemoteCompatible
public static boolean isRemoteCompatible(NetworkManager manager)
-
-