Interface PayloadTypeRegistry<B extends net.minecraft.network.FriendlyByteBuf>
- All Known Implementing Classes:
PayloadTypeRegistryImpl
-
Method Summary
Modifier and TypeMethodDescriptionstatic PayloadTypeRegistry<net.minecraft.network.FriendlyByteBuf> static PayloadTypeRegistry<net.minecraft.network.RegistryFriendlyByteBuf> <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.static PayloadTypeRegistry<net.minecraft.network.FriendlyByteBuf> static PayloadTypeRegistry<net.minecraft.network.RegistryFriendlyByteBuf>
-
Method Details
-
register
<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.This must be done on both the sending and receiving side, usually during mod initialization and before registering a packet handler.
- Type Parameters:
T- the payload class- Parameters:
type- the payload typecodec- the codec for the payload type- Returns:
- the registered payload type
-
registerLarge
<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.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.
- 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
<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.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.- 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
-
serverboundConfiguration
- Returns:
- the
PayloadTypeRegistryinstance for the serverbound (client to server) configuration channel.
-
clientboundConfiguration
- Returns:
- the
PayloadTypeRegistryinstance for the clientbound (server to client) configuration channel.
-
serverboundPlay
- Returns:
- the
PayloadTypeRegistryinstance for the serverbound (client to server) play channel.
-
clientboundPlay
- Returns:
- the
PayloadTypeRegistryinstance for the clientbound (server to client) play channel.
-