Package net.minecraftforge.network
Record Class PayloadChannel.Builder.Flow<BUF extends FriendlyByteBuf,BASE extends CustomPacketPayload>
java.lang.Object
java.lang.Record
net.minecraftforge.network.PayloadChannel.Builder.Flow<BUF,BASE>
- All Implemented Interfaces:
ChannelBuildable<CustomPacketPayload>,PayloadConnection<BASE>,PayloadFlow<BUF,,BASE> PayloadProtocol<BUF,,BASE> PayloadChannel.Builder.ProtocolFactory<BUF,,BASE> BaseProtocol<PayloadFlow<BUF,BASE>, PayloadProtocol<BUF, BASE>>
- Enclosing class:
PayloadChannel.Builder
private static record PayloadChannel.Builder.Flow<BUF extends FriendlyByteBuf,BASE extends CustomPacketPayload> (PayloadChannel.Builder.BuilderContext<BUF extends FriendlyByteBuf,BASE extends CustomPacketPayload> ctx)
extends Record
implements PayloadChannel.Builder.ProtocolFactory<BUF,BASE>, PayloadFlow<BUF,BASE>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final PayloadChannel.Builder.BuilderContext<BUF, BASE> The field for thectxrecord component. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateCreates an instance of aFlowrecord class. -
Method Summary
Modifier and TypeMethodDescription<MSG extends BASE>
PayloadChannel.Builder.Flow<BUF, BASE> add(CustomPacketPayload.Type<MSG> type, StreamCodec<BUF, MSG> codec, BiConsumer<MSG, CustomPayloadEvent.Context> consumer) Adds a packet to this channel that has it's protocol validated whenever sent or received.ctx()Returns the value of thectxrecord component.final booleanIndicates whether some other object is "equal to" this one.flow(@Nullable PacketFlow flow) final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraftforge.network.simple.BaseProtocol
bidirectional, bidirectional, clientbound, clientbound, flow, flow, serverbound, serverboundMethods inherited from interface net.minecraftforge.network.PayloadChannel.Builder.ProtocolFactory
build, protocol, protocolMethods 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, protocolMethods inherited from interface net.minecraftforge.network.payload.PayloadFlow
addMain
-
Field Details
-
ctx
private final PayloadChannel.Builder.BuilderContext<BUF extends FriendlyByteBuf,BASE extends CustomPacketPayload> ctxThe field for thectxrecord component.
-
-
Constructor Details
-
Flow
Creates an instance of aFlowrecord class.- Parameters:
ctx- the value for thectxrecord component
-
-
Method Details
-
add
public <MSG extends BASE> PayloadChannel.Builder.Flow<BUF,BASE> add(CustomPacketPayload.Type<MSG> type, StreamCodec<BUF, MSG> codec, BiConsumer<MSG, CustomPayloadEvent.Context> consumer) Description copied from interface:PayloadFlowAdds a packet to this channel that has it's protocol validated whenever sent or received.The handler is called on the network thread, and so should not interact with most game state by default.
CustomPayloadEvent.Context.enqueueWork(Runnable)can be used to handle the message on the main server or client thread.- Specified by:
addin interfacePayloadFlow<BUF extends FriendlyByteBuf,BASE extends CustomPacketPayload>
-
flow
- Specified by:
flowin interfaceBaseProtocol<BUF extends FriendlyByteBuf,BASE extends CustomPacketPayload>
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
ctx
Returns the value of thectxrecord component.- Specified by:
ctxin interfacePayloadChannel.Builder.ProtocolFactory<BUF extends FriendlyByteBuf,BASE extends CustomPacketPayload> - Returns:
- the value of the
ctxrecord component
-