public interface Environment
SidedEnvironment
.
When a tile entity implements this interface a good way of connecting and
disconnecting is the following pattern:
void updateEntity() { super.updateEntity() if (node != null && node.network == null) { api.Network.joinOrCreateNetwork(this); } } void onChunkUnload() { super.onChunkUnload() if (node != null) node.remove() } void invalidate() { super.invalidate() if (node != null) node.remove() }Item environments are always managed, so you will always have to provide a driver for items that should interact with the component network. To interact with environments from user code you will have to do two things:
node()
a Component
and ensure
its Component.visibility()
is set to a value where it can
be seen by computers in the network.Callback
s.Modifier and Type | Method and Description |
---|---|
Node |
node()
The node this environment wraps.
|
void |
onConnect(Node node)
This is called when a node is added to a network.
|
void |
onDisconnect(Node node)
This is called when a node is removed from the network.
|
void |
onMessage(Message message)
This is the generic message handler.
|
Node node()
void onConnect(Node node)
void onDisconnect(Node node)