Interface INetwork
- All Superinterfaces:
IFullNetworkListener
,org.cyclops.cyclopscore.persist.nbt.INBTSerializable
- All Known Implementing Classes:
Network
public interface INetwork
extends IFullNetworkListener, org.cyclops.cyclopscore.persist.nbt.INBTSerializable
A network can hold a set of
INetworkElement
s.
Note that this network only contains references to the relevant data, it does not contain the actual information.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cyclops.cyclopscore.persist.nbt.INBTSerializable
org.cyclops.cyclopscore.persist.nbt.INBTSerializable.SelfNBTClassType
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a given network element to the tickable elements set.boolean
containsSidedPathElement
(ISidedPathElement sidedPathElement) int
<T> net.minecraftforge.common.util.LazyOptional<T>
getCapability
(net.minecraftforge.common.capabilities.Capability<T> capability) Get the given capability.long
getLastSecondDuration
(INetworkElement networkElement) Get the last tick duration of the given network element.boolean
void
invalidateElement
(INetworkElement element) Invalidate the given element.boolean
boolean
boolean
isKilled()
boolean
Kills the network is it had no more network elements.void
Remove given network element from the tickable elements set.void
Reset the last second duration counts.void
revalidateElement
(INetworkElement element) Revalidate the given element.void
setCrashed
(boolean crashed) void
setPriorityAndChannel
(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
Methods inherited from interface org.cyclops.cyclopscore.persist.nbt.INBTSerializable
fromNBT, toNBT
-
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
<T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability) 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:
invalidateElement
in 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:
revalidateElement
in interfaceIFullNetworkListener
- Parameters:
element
- The network element to invalidate.
-
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.
-