Interface INetworkElement

All Superinterfaces:
Comparable<INetworkElement>
All Known Subinterfaces:
IEnergyConsumingNetworkElement, IEventListenableNetworkElement<D>, IPartNetworkElement<P,S>, IPositionedNetworkElement, ISidedNetworkElement
All Known Implementing Classes:
CoalGeneratorNetworkElement, ConsumingNetworkElementBase, DelayNetworkElement, EnergyBatteryNetworkElement, MaterializerNetworkElement, MechanicalMachineNetworkElement, NetworkElementBase, PartNetworkElement, ProxyNetworkElement, TileNetworkElement, VariablestoreNetworkElement

public interface INetworkElement extends Comparable<INetworkElement>
Objects that can be an element of a INetwork. Multiple instances for the same 'element' can be created, so the comparator implementation must make sure that these instances are considered equal. These instances are used as a simple way of referring to these elements.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addDrops(List<net.minecraft.world.item.ItemStack> itemStacks, boolean dropMainElement, boolean saveState)
    Add the itemstacks to drop when this element is removed.
    void
    Called right after this network is initialized.
    void
    Called right after this network has come alive again, for example after a network restart.
    void
    Called right before the network is terminated or will be reset.
    boolean
    Check if this element can be revalidated if it has been invalidated.
    int
     
    int
     
    int
     
    void
    Invalidate this network element.
    boolean
     
    void
    onNeighborBlockChange(INetwork network, net.minecraft.world.level.BlockGetter world, net.minecraft.world.level.block.Block neighbourBlock, net.minecraft.core.BlockPos neighbourBlockPos)
    Called when a neighbouring block is updated, more specifically when BlockBehaviour.neighborChanged(BlockState, Level, BlockPos, Block, BlockPos, boolean), IForgeBlock.onNeighborChange(BlockState, LevelReader, BlockPos, BlockPos) or BlockBehaviour.updateShape(BlockState, Direction, BlockState, LevelAccessor, BlockPos, BlockPos) is called.
    boolean
    Called when this element is added to the network.
    void
    Called when this element is removed from the network.
    void
    Called when this element has been removed.
    void
    Called when this element is about to be removed.
    void
    Revalidate this network element after it has been invalidated.
    void
    setPriorityAndChannel(INetwork network, int priority, int channel)
    Deprecated.
    void
    update(INetwork network)
    Update at the tick interval specified.

    Methods inherited from interface java.lang.Comparable

    compareTo
  • Method Details

    • getUpdateInterval

      int getUpdateInterval()
      Returns:
      The tick interval to update this element.
    • isUpdate

      boolean isUpdate()
      Returns:
      If this element should be updated. This method is only called once during network initialization.
    • update

      void update(INetwork network)
      Update at the tick interval specified.
      Parameters:
      network - The network to update in.
    • beforeNetworkKill

      void beforeNetworkKill(INetwork network)
      Called right before the network is terminated or will be reset.
      Parameters:
      network - The network to update in.
    • afterNetworkAlive

      void afterNetworkAlive(INetwork network)
      Called right after this network is initialized.
      Parameters:
      network - The network to update in.
    • afterNetworkReAlive

      void afterNetworkReAlive(INetwork network)
      Called right after this network has come alive again, for example after a network restart.
      Parameters:
      network - The network to update in.
    • addDrops

      void addDrops(List<net.minecraft.world.item.ItemStack> itemStacks, boolean dropMainElement, boolean saveState)
      Add the itemstacks to drop when this element is removed.
      Parameters:
      itemStacks - The itemstack list to add to.
      dropMainElement - If the part itself should also be dropped.
      saveState - If the element state should be saved in the item.
    • onNetworkAddition

      boolean onNetworkAddition(INetwork network)
      Called when this element is added to the network.
      Parameters:
      network - The network.
      Returns:
      If the addition succeeded.
    • onNetworkRemoval

      void onNetworkRemoval(INetwork network)
      Called when this element is removed from the network.
      Parameters:
      network - The network.
    • onPreRemoved

      void onPreRemoved(INetwork network)
      Called when this element is about to be removed. This is called before IFullNetworkListener.removeNetworkElementPre(INetworkElement).
      Parameters:
      network - The network.
    • onPostRemoved

      void onPostRemoved(INetwork network)
      Called when this element has been removed. This is called after IFullNetworkListener.removeNetworkElementPost(INetworkElement).
      Parameters:
      network - The network.
    • onNeighborBlockChange

      void onNeighborBlockChange(@Nullable INetwork network, net.minecraft.world.level.BlockGetter world, net.minecraft.world.level.block.Block neighbourBlock, net.minecraft.core.BlockPos neighbourBlockPos)
      Called when a neighbouring block is updated, more specifically when BlockBehaviour.neighborChanged(BlockState, Level, BlockPos, Block, BlockPos, boolean), IForgeBlock.onNeighborChange(BlockState, LevelReader, BlockPos, BlockPos) or BlockBehaviour.updateShape(BlockState, Direction, BlockState, LevelAccessor, BlockPos, BlockPos) is called.
      Parameters:
      network - The network to update in.
      world - The world in which the neighbour was updated.
      neighbourBlock - block type of the neighbour that was updated.
      neighbourBlockPos - The position of the neighbour that was updated.
    • setPriorityAndChannel

      @Deprecated void setPriorityAndChannel(INetwork network, int priority, int channel)
      Deprecated.
      Set the priority and channel of this element in the network.
      Parameters:
      network - The network this element is present in.
      priority - The new priority
      channel - The new channel
    • getPriority

      int getPriority()
      Returns:
      The priority of this element in the network.
    • getChannel

      int getChannel()
      Returns:
      The channel of this element in the network.
    • invalidate

      void invalidate(INetwork network)
      Invalidate this network element.
      Parameters:
      network - The network.
    • canRevalidate

      boolean canRevalidate(INetwork network)
      Check if this element can be revalidated if it has been invalidated.
      Parameters:
      network - The network.
      Returns:
      If it can be revalidated.
    • revalidate

      void revalidate(INetwork network)
      Revalidate this network element after it has been invalidated.
      Parameters:
      network - The network.