Interface INetwork
- All Superinterfaces:
IFullNetworkListener
- All Known Implementing Classes:
Network
A network can hold a set of
INetworkElements.
Note that this network only contains references to the relevant data, it does not contain the actual information.-
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a given network element to the tickable elements set.booleancontainsSidedPathElement(ISidedPathElement sidedPathElement) int<T> Optional<T> getCapability(NetworkCapability<T> capability) Get the given capability.longgetLastSecondDuration(INetworkElement networkElement) Get the last tick duration of the given network element.booleanvoidinvalidateElement(INetworkElement element) Invalidate the given element.booleanbooleanbooleanisKilled()booleanisValid(INetworkElement element) If the network element has not been invalidated.booleanKills the network is it had no more network elements.voidRemove given network element from the tickable elements set.voidReset the last second duration counts.voidrevalidateElement(INetworkElement element) Revalidate the given element.voidsetCrashed(boolean crashed) voidsetPriorityAndChannel(INetworkElement element, int priority, int channel) Set the priority and channel of the given network element.Methods inherited from interface org.cyclops.integrateddynamics.api.network.IFullNetworkListener
addNetworkElement, afterServerLoad, beforeServerStop, canUpdate, kill, onSkipUpdate, postUpdate, removeNetworkElementPost, removeNetworkElementPre, removePathElement, update, updateGuaranteed
-
Method Details
-
isInitialized
boolean isInitialized()- Returns:
- If this network and its elements have been fully initialized.
-
getEventBus
INetworkEventBus getEventBus()- Returns:
- The event bus for this network.
-
addNetworkElementUpdateable
Add a given network element to the tickable elements set.- Parameters:
element- The network element.
-
removeNetworkElementUpdateable
Remove given network element from the tickable elements set.- Parameters:
element- The network element.
-
setPriorityAndChannel
Set the priority and channel of the given network element.- Parameters:
element- The network element.priority- The new prioritychannel- The new channel
-
killIfEmpty
boolean killIfEmpty()Kills the network is it had no more network elements.- Returns:
- If the network was killed.
-
getElements
Set<INetworkElement> getElements()- Returns:
- The network elements.
-
isKilled
boolean isKilled()- Returns:
- If this network has been killed.
-
hasChanged
boolean hasChanged()- Returns:
- If the network has changed structure or elements in the last tick.
-
getCablesCount
int getCablesCount()- Returns:
- The number of cables in the network.
-
getLastSecondDuration
Get the last tick duration of the given network element.- Parameters:
networkElement- The networkelement- Returns:
- Duration in nanoseconds
-
resetLastSecondDurations
void resetLastSecondDurations()Reset the last second duration counts. -
isCrashed
boolean isCrashed()- Returns:
- If this network has crashed.
-
setCrashed
void setCrashed(boolean crashed) - Parameters:
crashed- The new crashed field.
-
getCapability
Get the given capability.- Type Parameters:
T- The capability type.- Parameters:
capability- The capability to get.- Returns:
- The optional capability instance.
-
invalidateElement
Invalidate the given element. This should be called when the element's chunk is being unloaded.- Specified by:
invalidateElementin interfaceIFullNetworkListener- Parameters:
element- The network element to invalidate.
-
revalidateElement
Revalidate the given element. This should be called when the element's chunk is being reloaded.- Specified by:
revalidateElementin interfaceIFullNetworkListener- Parameters:
element- The network element to invalidate.
-
isValid
If the network element has not been invalidated.- Parameters:
element- A network element.- Returns:
- If it is valid.
-
containsSidedPathElement
- Parameters:
sidedPathElement- A sided path element.- Returns:
- If this network contains the given sided path element.
-
getFullNetworkListeners
IFullNetworkListener[] getFullNetworkListeners()- Returns:
- All registered network listeners.
-