Class PayloadTypeRegistryImpl<B extends net.minecraft.network.FriendlyByteBuf>
- All Implemented Interfaces:
PayloadTypeRegistry<B>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PayloadTypeRegistryImpl<net.minecraft.network.FriendlyByteBuf> static final PayloadTypeRegistryImpl<net.minecraft.network.RegistryFriendlyByteBuf> static final PayloadTypeRegistryImpl<net.minecraft.network.FriendlyByteBuf> static final PayloadTypeRegistryImpl<net.minecraft.network.RegistryFriendlyByteBuf> -
Method Summary
Modifier and TypeMethodDescription<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
@Nullable net.minecraft.network.protocol.common.custom.CustomPacketPayload.TypeAndCodec<B, T> get(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type) static @Nullable PayloadTypeRegistryImpl<?> get(net.minecraft.network.ProtocolInfo<?> state) @Nullable net.minecraft.network.protocol.common.custom.CustomPacketPayload.TypeAndCodec<B, ? extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> get(net.minecraft.resources.Identifier id) net.minecraft.network.protocol.PacketFlowgetFlow()intgetMaxPacketSizeForSplitting(net.minecraft.resources.Identifier id) net.minecraft.network.ConnectionProtocol<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
net.minecraft.network.protocol.common.custom.CustomPacketPayload.TypeAndCodec<? super B, T> register(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, net.minecraft.network.codec.StreamCodec<? super B, T> codec) Registers a custom payload type.<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
net.minecraft.network.protocol.common.custom.CustomPacketPayload.TypeAndCodec<? super B, T> registerLarge(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, net.minecraft.network.codec.StreamCodec<? super B, T> codec, int maxPacketSize) Registers a large custom payload type.<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
net.minecraft.network.protocol.common.custom.CustomPacketPayload.TypeAndCodec<? super B, T> registerLarge(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, net.minecraft.network.codec.StreamCodec<? super B, T> codec, IntSupplier maxPacketSizeSupplier) Registers a large custom payload type.
-
Field Details
-
SERVERBOUND_CONFIGURATION
public static final PayloadTypeRegistryImpl<net.minecraft.network.FriendlyByteBuf> SERVERBOUND_CONFIGURATION -
CLIENTBOUND_CONFIGURATION
public static final PayloadTypeRegistryImpl<net.minecraft.network.FriendlyByteBuf> CLIENTBOUND_CONFIGURATION -
SERVERBOUND_PLAY
public static final PayloadTypeRegistryImpl<net.minecraft.network.RegistryFriendlyByteBuf> SERVERBOUND_PLAY -
CLIENTBOUND_PLAY
public static final PayloadTypeRegistryImpl<net.minecraft.network.RegistryFriendlyByteBuf> CLIENTBOUND_PLAY
-
-
Method Details
-
get
-
register
public <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> net.minecraft.network.protocol.common.custom.CustomPacketPayload.TypeAndCodec<? super B, T> register(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, net.minecraft.network.codec.StreamCodec<? super B, T> codec) Description copied from interface:PayloadTypeRegistryRegisters a custom payload type.This must be done on both the sending and receiving side, usually during mod initialization and before registering a packet handler.
- Specified by:
registerin interfacePayloadTypeRegistry<B extends net.minecraft.network.FriendlyByteBuf>- Type Parameters:
T- the payload class- Parameters:
type- the payload typecodec- the codec for the payload type- Returns:
- the registered payload type
-
registerLarge
public <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> net.minecraft.network.protocol.common.custom.CustomPacketPayload.TypeAndCodec<? super B, T> registerLarge(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, net.minecraft.network.codec.StreamCodec<? super B, T> codec, int maxPacketSize) Description copied from interface:PayloadTypeRegistryRegisters a large custom payload type.This must be done on both the sending and receiving side, usually during mod initialization and before registering a packet handler.
Payload types registered with this method will be split into multiple packets, allowing to send packets larger than the vanilla limited size.
- Specified by:
registerLargein interfacePayloadTypeRegistry<B extends net.minecraft.network.FriendlyByteBuf>- Type Parameters:
T- the payload class- Parameters:
type- the payload typecodec- the codec for the payload typemaxPacketSize- the maximum size of payload packet- Returns:
- the registered payload type
-
registerLarge
public <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> net.minecraft.network.protocol.common.custom.CustomPacketPayload.TypeAndCodec<? super B, T> registerLarge(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, net.minecraft.network.codec.StreamCodec<? super B, T> codec, IntSupplier maxPacketSizeSupplier) Description copied from interface:PayloadTypeRegistryRegisters a large custom payload type.This must be done on both the sending and receiving side, usually during mod initialization and before registering a packet handler.
Payload types registered with this method will be split into multiple packets, allowing to send packets larger than the vanilla limited size.
The
maxPacketSizeSupplierwill be called once, right before the first packet of this payload type is sent/received on either side. This allows mods some leeway particularly during mod initialization to dynamically determine a suitable max size.- Specified by:
registerLargein interfacePayloadTypeRegistry<B extends net.minecraft.network.FriendlyByteBuf>- Type Parameters:
T- the payload type- Parameters:
type- the payload typecodec- the codec for the payload typemaxPacketSizeSupplier- the function that returns the max size of payload packet- Returns:
- the registered payload type
-
get
public @Nullable net.minecraft.network.protocol.common.custom.CustomPacketPayload.TypeAndCodec<B, ? extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> get(net.minecraft.resources.Identifier id) -
get
public <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> @Nullable net.minecraft.network.protocol.common.custom.CustomPacketPayload.TypeAndCodec<B,T> get(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type) -
getMaxPacketSizeForSplitting
public int getMaxPacketSizeForSplitting(net.minecraft.resources.Identifier id) - Returns:
- the max packet size, or -1 if the payload type does not need splitting.
-
getProtocol
public net.minecraft.network.ConnectionProtocol getProtocol() -
getFlow
public net.minecraft.network.protocol.PacketFlow getFlow()
-