NetworkManager

object NetworkManager : Listener

Properties

Link copied to clipboard

A sequence of all loaded NetworkClusters.

Link copied to clipboard

A sequence of all loaded Networks.

Functions

Link copied to clipboard
suspend fun getNode(pos: BlockPos): NetworkNode?

Gets the NetworkNode at the specified block pos using the registered NetworkNodeProviders or null if there is none.

Link copied to clipboard
suspend fun getNodes(pos: ChunkPos): List<NetworkNode>

Gets all NetworkNodes in the chunk at pos using the registered NetworkNodeProviders.

Link copied to clipboard
fun queue(pos: ChunkPos, task: suspend (NetworkState) -> Boolean)

Queues a custom network task in pos that may or may not change the network state. The task then returns whether the network state was changed.

Link copied to clipboard
fun queueAddBridge(bridge: NetworkBridge, supportedNetworkTypes: Set<NetworkType<*>>, bridgeFaces: Set<BlockFace>, updateNodes: Boolean = true)

Queues a network task to add bridge to the network state, using the specified supportedNetworkTypes and bridgeFaces.

Link copied to clipboard
fun queueAddEndPoint(endPoint: NetworkEndPoint, updateNodes: Boolean = true)

Queues a network task to add endPoint to the network state.

Link copied to clipboard
fun queueRead(pos: ChunkPos, read: suspend (NetworkState) -> Unit)

Queues a custom network task in pos that will definitely not change the network state.

Link copied to clipboard
fun queueRemoveBridge(bridge: NetworkBridge, updateNodes: Boolean = true)

Queues a network task to remove bridge from the network state.

Link copied to clipboard
fun queueRemoveEndPoint(endPoint: NetworkEndPoint, updateNodes: Boolean = true)

Queues a network task to remove endPoint from the network state.

Link copied to clipboard
fun queueWrite(pos: ChunkPos, write: suspend (NetworkState) -> Unit)

Queues a custom network task in pos that will definitely change the network state.

Link copied to clipboard
fun Listener.registerEvent(eventClass: Class<out Event>)
fun Listener.registerEvent(eventClass: KClass<out Event>)
Link copied to clipboard
fun Listener.registerEventFirst(eventClass: Class<out Event>)
fun Listener.registerEventFirst(eventClass: KClass<out Event>)
Link copied to clipboard
fun Listener.registerEvents()
Link copied to clipboard
fun Listener.registerEventsExcept(vararg eventClasses: Class<out Event>)
fun Listener.registerEventsExcept(vararg eventClasses: KClass<out Event>)
Link copied to clipboard
fun Listener.registerEventsFirst()
Link copied to clipboard

Registers a new NetworkNodeProvider, which will be used to discover NetworkNodes during chunk load and end point / bridge add tasks.

Link copied to clipboard
fun Listener.unregisterEvents()