Record Class Packet
java.lang.Object
java.lang.Record
dan200.computercraft.api.network.Packet
- Record Components:
channel- The channel to send the packet along. Receiving devices should only process packets from on channels they are listening to.replyChannel- The channel to reply on.payload- The contents of this packet. This should be a "valid" Lua object, safe for queuing as an event or returning from a peripheral call.sender- The object which sent this packet.
public record Packet(int channel, int replyChannel, Object payload, PacketSender sender)
extends Record
Represents a packet which may be sent across a
PacketNetwork.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPacket(int channel, int replyChannel, Object payload, PacketSender sender) Creates an instance of aPacketrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintchannel()Returns the value of thechannelrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.payload()Returns the value of thepayloadrecord component.intReturns the value of thereplyChannelrecord component.sender()Returns the value of thesenderrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Packet
Creates an instance of aPacketrecord class.- Parameters:
channel- the value for thechannelrecord componentreplyChannel- the value for thereplyChannelrecord componentpayload- the value for thepayloadrecord componentsender- the value for thesenderrecord component
-
-
Method Details
-
toString
-
hashCode
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
channel
-
replyChannel
public int replyChannel()Returns the value of thereplyChannelrecord component.- Returns:
- the value of the
replyChannelrecord component
-
payload
-
sender
-