public interface IWiredNode extends IPacketNetwork
IWiredElement
s and IWiredNetwork
s.
Firstly, a node acts as a packet network, capable of sending and receiving modem messages to connected nodes. These
methods may be safely used on any thread.
When sending a packet, the system will attempt to find the shortest path between the two nodes based on their
element's position. Note that packet senders and receivers can have different locations from their associated
element: the distance between the two will be added to the total packet's distance.
Wired nodes also provide several convenience methods for interacting with a wired network. These should only ever
be used on the main server thread.Modifier and Type | Method and Description |
---|---|
default boolean |
connectTo(IWiredNode node)
Create a connection from this node to another.
|
default boolean |
disconnectFrom(IWiredNode node)
Destroy a connection between this node and another.
|
IWiredElement |
getElement()
The associated element for this network node.
|
IWiredNetwork |
getNetwork()
The network this node is currently connected to.
|
default boolean |
remove()
Sever all connections this node has, removing it from this network.
|
default void |
updatePeripherals(java.util.Map<java.lang.String,IPeripheral> peripherals)
Mark this node's peripherals as having changed.
|
addReceiver, isWireless, removeReceiver, transmitInterdimensional, transmitSameDimension
@Nonnull IWiredElement getElement()
@Nonnull IWiredNetwork getNetwork()
default boolean connectTo(@Nonnull IWiredNode node)
node
- The other node to connect to.true
if a connection was created or false
if the connection already exists.IWiredNetwork.connect(IWiredNode, IWiredNode)
,
disconnectFrom(IWiredNode)
default boolean disconnectFrom(@Nonnull IWiredNode node)
node
- The other node to disconnect from.true
if a connection was destroyed or false
if no connection exists.java.lang.IllegalArgumentException
- If node
is not on the same network.IWiredNetwork.disconnect(IWiredNode, IWiredNode)
,
connectTo(IWiredNode)
default boolean remove()
java.lang.IllegalArgumentException
- If the node is not in the network.IWiredNetwork.remove(IWiredNode)
default void updatePeripherals(@Nonnull java.util.Map<java.lang.String,IPeripheral> peripherals)
peripherals
- The new peripherals for this node.IWiredNetwork.updatePeripherals(IWiredNode, Map)