Record Class NetworkRegistry.ClientPacketHandler
java.lang.Object
java.lang.Record
net.neoforged.neoforge.network.registration.NetworkRegistry.ClientPacketHandler
- All Implemented Interfaces:
IPacketHandler
- Enclosing class:
- NetworkRegistry
private static record NetworkRegistry.ClientPacketHandler(ClientCommonPacketListener listener)
extends Record
implements IPacketHandler
-
Field Summary
Modifier and TypeFieldDescriptionprivate final ClientCommonPacketListener
The field for thelistener
record component. -
Constructor Summary
ModifierConstructorDescriptionprivate
Creates an instance of aClientPacketHandler
record class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
disconnect
(Component reason) Trigger a disconnect from the network.final boolean
Indicates whether some other object is "equal to" this one.void
handle
(CustomPacketPayload payload) Invoked to handle the given custom payload.void
Invoked to handle the given packet.final int
hashCode()
Returns a hash code value for this object.listener()
Returns the value of thelistener
record component.private static <T extends PacketListener>
voidresolvePacketGenerics
(Packet<T> packet, ClientCommonPacketListener listener) final String
toString()
Returns a string representation of this record class.
-
Field Details
-
listener
The field for thelistener
record component.
-
-
Constructor Details
-
ClientPacketHandler
Creates an instance of aClientPacketHandler
record class.- Parameters:
listener
- the value for thelistener
record component
-
-
Method Details
-
handle
Description copied from interface:IPacketHandler
Invoked to handle the given packet.- Specified by:
handle
in interfaceIPacketHandler
- Parameters:
packet
- The packet.
-
handle
Description copied from interface:IPacketHandler
Invoked to handle the given custom payload.- Specified by:
handle
in interfaceIPacketHandler
- Parameters:
payload
- The payload.
-
disconnect
Description copied from interface:IPacketHandler
Trigger a disconnect from the network.- Specified by:
disconnect
in interfaceIPacketHandler
- Parameters:
reason
- The reason for the disconnect.
-
resolvePacketGenerics
private static <T extends PacketListener> void resolvePacketGenerics(Packet<T> packet, ClientCommonPacketListener listener) -
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)
. -
listener
Returns the value of thelistener
record component.- Returns:
- the value of the
listener
record component
-