Package net.minecraftforge.network
Record Class NetworkDirection<B extends FriendlyByteBuf>
java.lang.Object
java.lang.Record
net.minecraftforge.network.NetworkDirection<B>
public record NetworkDirection<B extends FriendlyByteBuf>(NetworkProtocol<B extends FriendlyByteBuf> protocol, PacketFlow direction)
extends Record
-
Field Summary
Modifier and TypeFieldDescriptionstatic final NetworkDirection
<FriendlyByteBuf> static final NetworkDirection
<FriendlyByteBuf> private final PacketFlow
The field for thedirection
record component.static final NetworkDirection
<FriendlyByteBuf> static final NetworkDirection
<FriendlyByteBuf> static final NetworkDirection
<RegistryFriendlyByteBuf> static final NetworkDirection
<RegistryFriendlyByteBuf> private final NetworkProtocol
<B> The field for theprotocol
record component. -
Constructor Summary
ConstructorDescriptionNetworkDirection
(NetworkProtocol<B> protocol, PacketFlow direction) Creates an instance of aNetworkDirection
record class. -
Method Summary
Modifier and TypeMethodDescription<T extends PacketListener,
MSG>
Packet<T> buildPacket
(Channel<MSG> channel, MSG packet) Returns the value of thedirection
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.protocol()
Returns the value of theprotocol
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
protocol
The field for theprotocol
record component. -
direction
The field for thedirection
record component. -
PLAY_TO_CLIENT
-
PLAY_TO_SERVER
-
LOGIN_TO_CLIENT
-
LOGIN_TO_SERVER
-
CONFIGURATION_TO_CLIENT
-
CONFIGURATION_TO_SERVER
-
-
Constructor Details
-
NetworkDirection
Creates an instance of aNetworkDirection
record class.- Parameters:
protocol
- the value for theprotocol
record componentdirection
- the value for thedirection
record component
-
-
Method Details
-
buildPacket
-
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)
. -
protocol
Returns the value of theprotocol
record component.- Returns:
- the value of the
protocol
record component
-
direction
Returns the value of thedirection
record component.- Returns:
- the value of the
direction
record component
-