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 INetworkElements. Note that this network only contains references to the relevant data, it does not contain the actual information.
  • 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

      void addNetworkElementUpdateable(INetworkElement element)
      Add a given network element to the tickable elements set.
      Parameters:
      element - The network element.
    • removeNetworkElementUpdateable

      void removeNetworkElementUpdateable(INetworkElement element)
      Remove given network element from the tickable elements set.
      Parameters:
      element - The network element.
    • setPriorityAndChannel

      void setPriorityAndChannel(INetworkElement element, int priority, int channel)
      Set the priority and channel of the given network element.
      Parameters:
      element - The network element.
      priority - The new priority
      channel - 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

      long getLastSecondDuration(INetworkElement networkElement)
      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> Optional<T> getCapability(NetworkCapability<T> capability)
      Get the given capability.
      Type Parameters:
      T - The capability type.
      Parameters:
      capability - The capability to get.
      Returns:
      The optional capability instance.
    • invalidateElement

      void invalidateElement(INetworkElement element)
      Invalidate the given element. This should be called when the element's chunk is being unloaded.
      Specified by:
      invalidateElement in interface IFullNetworkListener
      Parameters:
      element - The network element to invalidate.
    • revalidateElement

      void revalidateElement(INetworkElement element)
      Revalidate the given element. This should be called when the element's chunk is being reloaded.
      Specified by:
      revalidateElement in interface IFullNetworkListener
      Parameters:
      element - The network element to invalidate.
    • containsSidedPathElement

      boolean containsSidedPathElement(ISidedPathElement sidedPathElement)
      Parameters:
      sidedPathElement - A sided path element.
      Returns:
      If this network contains the given sided path element.
    • getFullNetworkListeners

      IFullNetworkListener[] getFullNetworkListeners()
      Returns:
      All registered network listeners.