Interface IGridNodeListener<T>


public interface IGridNodeListener<T>
Interface that allows a grid node to notify it's host about various events.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    Gives a reason for why the active state of the node might have changed.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    onGridChanged(T nodeOwner, IGridNode node)
    called when the grid for the node has changed, the general grid state should not be trusted at this point.
    default void
    Called by the IGridNode when the visible connections for the node have changed, useful for cable.
    default void
    onOwnerChanged(T nodeOwner, IGridNode node)
    Called by the IGridNode when the node's owner has changed.
    void
    onSaveChanges(T nodeOwner, IGridNode node)
    Called by the IGridNode when it's persistent state has changed and the host needs to ensure it is saved.
    default void
    Called when one of the node's state properties has changed.
  • Method Details

    • onSaveChanges

      void onSaveChanges(T nodeOwner, IGridNode node)
      Called by the IGridNode when it's persistent state has changed and the host needs to ensure it is saved. Can be implemented on block entities by delegating to BlockEntity.setChanged() for example.
    • onInWorldConnectionChanged

      default void onInWorldConnectionChanged(T nodeOwner, IGridNode node)
      Called by the IGridNode when the visible connections for the node have changed, useful for cable.
    • onOwnerChanged

      default void onOwnerChanged(T nodeOwner, IGridNode node)
      Called by the IGridNode when the node's owner has changed. The node's state needs to be saved.
    • onGridChanged

      default void onGridChanged(T nodeOwner, IGridNode node)
      called when the grid for the node has changed, the general grid state should not be trusted at this point.
    • onStateChanged

      default void onStateChanged(T nodeOwner, IGridNode node, IGridNodeListener.State state)
      Called when one of the node's state properties has changed. Any of those changes might have potentially changed the active-state as well.
      Parameters:
      state - Indicates the node property that might have changed.