Package net.minecraftforge.network
Class PayloadChannel.Builder
java.lang.Object
net.minecraftforge.network.PayloadChannel.Builder
- All Implemented Interfaces:
PayloadConnection<CustomPacketPayload>
- Enclosing class:
PayloadChannel
private static final class PayloadChannel.Builder
extends Object
implements PayloadConnection<CustomPacketPayload>
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static final record
private static final record
PayloadChannel.Builder.Flow<BUF extends FriendlyByteBuf,
BASE extends CustomPacketPayload> private static final record
PayloadChannel.Builder.HandlerFlow<BUF extends FriendlyByteBuf,
CTX, BASE extends CustomPacketPayload & SimplePacket<CTX>> private static final record
PayloadChannel.Builder.HandlerProtocol<BUF extends FriendlyByteBuf,
CTX, BASE extends CustomPacketPayload & SimplePacket<CTX>> private static final record
PayloadChannel.Builder.Protocol<BUF extends FriendlyByteBuf,
BASE extends CustomPacketPayload> private static interface
PayloadChannel.Builder.ProtocolFactory<BUF extends FriendlyByteBuf,
BASE extends CustomPacketPayload> -
Field Summary
Modifier and TypeFieldDescriptionprivate boolean
private final NetworkInstance
private final Map
<ResourceLocation, PayloadChannel.Message<?, ?>> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate void
add
(PayloadChannel.Message<?, ?> msg) build()
private void
<NEWBUF extends FriendlyByteBuf,
CTX, NEWBASE extends CustomPacketPayload & SimplePacket<CTX>>
PayloadHandlerProtocol<NEWBUF, NEWBASE> protocol
(io.netty.util.AttributeKey<CTX> context, NetworkProtocol<NEWBUF> protocol) Creates a builder grouping together all packets under the same protocol.<NEWBUF extends FriendlyByteBuf,
NEWBASE extends CustomPacketPayload>
PayloadProtocol<NEWBUF, NEWBASE> protocol
(NetworkProtocol<NEWBUF> protocol) Creates a builder grouping together all packets under the same protocol.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraftforge.network.payload.PayloadConnection
any, any, any, any, configuration, configuration, configuration, configuration, login, login, login, login, play, play, play, play, protocol, protocol
-
Field Details
-
instance
-
built
private boolean built -
payloads
-
-
Constructor Details
-
Builder
-
-
Method Details
-
protocol
public <NEWBUF extends FriendlyByteBuf,NEWBASE extends CustomPacketPayload> PayloadProtocol<NEWBUF,NEWBASE> protocol(NetworkProtocol<NEWBUF> protocol) Description copied from interface:PayloadConnection
Creates a builder grouping together all packets under the same protocol. This will validate that the protocol matches before the packet is sent or received.- Specified by:
protocol
in interfacePayloadConnection<CustomPacketPayload>
-
protocol
public <NEWBUF extends FriendlyByteBuf,CTX, PayloadHandlerProtocol<NEWBUF,NEWBASE extends CustomPacketPayload & SimplePacket<CTX>> NEWBASE> protocol(io.netty.util.AttributeKey<CTX> context, NetworkProtocol<NEWBUF> protocol) Description copied from interface:PayloadConnection
Creates a builder grouping together all packets under the same protocol. This will validate that the protocol matches before the packet is sent or received.- Specified by:
protocol
in interfacePayloadConnection<CustomPacketPayload>
-
add
-
checkBuilt
private void checkBuilt() -
build
-