Package dan200.computercraft.api.network
Interface PacketReceiver
public interface PacketReceiver
An object on an
PacketNetwork
, capable of receiving packets.-
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.level.Level
getLevel()
Get the world in which this packet receiver exists.net.minecraft.world.phys.Vec3
Get the position in the world at which this receiver exists.double
getRange()
Get the maximum distance this receiver can send and receive messages.boolean
Determine whether this receiver can receive packets from other dimensions.void
receiveDifferentDimension
(Packet packet) Receive a network packet from a different dimension.void
receiveSameDimension
(Packet packet, double distance) Receive a network packet from the same dimension.
-
Method Details
-
getLevel
net.minecraft.world.level.Level getLevel()Get the world in which this packet receiver exists.- Returns:
- The receivers's world.
-
getPosition
net.minecraft.world.phys.Vec3 getPosition()Get the position in the world at which this receiver exists.- Returns:
- The receiver's position.
-
getRange
double getRange()Get the maximum distance this receiver can send and receive messages.When determining whether a receiver can receive a message, the largest distance of the packet and receiver is used - ensuring it is within range. If the packet or receiver is inter-dimensional, then the packet will always be received.
- Returns:
- The maximum distance this device can send and receive messages.
- See Also:
-
isInterdimensional
boolean isInterdimensional()Determine whether this receiver can receive packets from other dimensions.A device will receive an inter-dimensional packet if either it or the sending device is inter-dimensional.
- Returns:
- Whether this receiver receives packets from other dimensions.
- See Also:
-
receiveSameDimension
Receive a network packet from the same dimension.- Parameters:
packet
- The packet to receive. Generally you should check that you are listening on the given channel and, if so, queue the appropriate modem event.distance
- The distance this packet has travelled from the source.- See Also:
-
receiveDifferentDimension
Receive a network packet from a different dimension.- Parameters:
packet
- The packet to receive. Generally you should check that you are listening on the given channel and, if so, queue the appropriate modem event.- See Also:
-