Class NetworkElementBase

java.lang.Object
org.cyclops.integrateddynamics.core.network.NetworkElementBase
All Implemented Interfaces:
Comparable<INetworkElement>, INetworkElement
Direct Known Subclasses:
CoalGeneratorNetworkElement, ConsumingNetworkElementBase, EnergyBatteryNetworkElement, MechanicalMachineNetworkElement, PartNetworkElement

public abstract class NetworkElementBase extends Object implements INetworkElement
Base implementation for a network element.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addDrops(net.minecraft.world.level.block.state.BlockState blockState, net.minecraft.world.level.block.entity.BlockEntity blockEntity, 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
    beforeNetworkKill(INetwork network, net.minecraft.world.level.block.state.BlockState blockState, net.minecraft.world.level.block.entity.BlockEntity blockEntity)
    Called right before the network is terminated or will be reset.
    protected boolean
    canRevalidatePositioned(INetwork network, org.cyclops.cyclopscore.datastructure.DimPos dimPos)
     
    int
     
    void
    Invalidate this network element.
    boolean
     
    void
    onNeighborBlockChange(INetwork network, net.minecraft.world.level.BlockGetter world)
    Called when a neighbouring block is updated, more specifically when BlockBehaviour.neighborChanged(BlockState, Level, BlockPos, Block, Orientation, boolean), IBlockExtension.onNeighborChange(BlockState, LevelReader, BlockPos, BlockPos) or BlockBehaviour.updateShape(BlockState, LevelReader, ScheduledTickAccess, BlockPos, Direction, BlockPos, BlockState, RandomSource) is called.
    boolean
    Called when this element is added to the network.
    void
    onNetworkRemoval(INetwork network, net.minecraft.world.level.block.state.BlockState blockState, net.minecraft.world.level.block.entity.BlockEntity blockEntity)
    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.
    protected void
    revalidatePositioned(INetwork network, org.cyclops.cyclopscore.datastructure.DimPos dimPos)
     
    void
    update(INetwork network)
    Update at the tick interval specified.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.lang.Comparable

    compareTo

    Methods inherited from interface org.cyclops.integrateddynamics.api.network.INetworkElement

    canRevalidate, getChannel, getPriority, onNeighborBlockChange, setPriorityAndChannel
  • Constructor Details

    • NetworkElementBase

      public NetworkElementBase()
  • Method Details

    • getUpdateInterval

      public int getUpdateInterval()
      Specified by:
      getUpdateInterval in interface INetworkElement
      Returns:
      The tick interval to update this element.
    • isUpdate

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

      public void update(INetwork network)
      Description copied from interface: INetworkElement
      Update at the tick interval specified.
      Specified by:
      update in interface INetworkElement
      Parameters:
      network - The network to update in.
    • beforeNetworkKill

      public void beforeNetworkKill(INetwork network, @Nullable net.minecraft.world.level.block.state.BlockState blockState, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity)
      Description copied from interface: INetworkElement
      Called right before the network is terminated or will be reset.
      Specified by:
      beforeNetworkKill in interface INetworkElement
      Parameters:
      network - The network to update in.
      blockState - The block state.
      blockEntity - The block entity.
    • afterNetworkAlive

      public void afterNetworkAlive(INetwork network)
      Description copied from interface: INetworkElement
      Called right after this network is initialized.
      Specified by:
      afterNetworkAlive in interface INetworkElement
      Parameters:
      network - The network to update in.
    • afterNetworkReAlive

      public void afterNetworkReAlive(INetwork network)
      Description copied from interface: INetworkElement
      Called right after this network has come alive again, for example after a network restart.
      Specified by:
      afterNetworkReAlive in interface INetworkElement
      Parameters:
      network - The network to update in.
    • addDrops

      public void addDrops(net.minecraft.world.level.block.state.BlockState blockState, net.minecraft.world.level.block.entity.BlockEntity blockEntity, List<net.minecraft.world.item.ItemStack> itemStacks, boolean dropMainElement, boolean saveState)
      Description copied from interface: INetworkElement
      Add the itemstacks to drop when this element is removed.
      Specified by:
      addDrops in interface INetworkElement
      Parameters:
      blockState - The block state of the container block.
      blockEntity - The block entity of the container block.
      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

      public boolean onNetworkAddition(INetwork network)
      Description copied from interface: INetworkElement
      Called when this element is added to the network.
      Specified by:
      onNetworkAddition in interface INetworkElement
      Parameters:
      network - The network.
      Returns:
      If the addition succeeded.
    • onNetworkRemoval

      public void onNetworkRemoval(INetwork network, net.minecraft.world.level.block.state.BlockState blockState, net.minecraft.world.level.block.entity.BlockEntity blockEntity)
      Description copied from interface: INetworkElement
      Called when this element is removed from the network.
      Specified by:
      onNetworkRemoval in interface INetworkElement
      Parameters:
      network - The network.
      blockState - The block state.
      blockEntity - The block entity.
    • onPreRemoved

      public void onPreRemoved(INetwork network)
      Description copied from interface: INetworkElement
      Called when this element is about to be removed. This is called before IFullNetworkListener.removeNetworkElementPre(INetworkElement).
      Specified by:
      onPreRemoved in interface INetworkElement
      Parameters:
      network - The network.
    • onPostRemoved

      public void onPostRemoved(INetwork network)
      Description copied from interface: INetworkElement
      Called when this element has been removed. This is called after IFullNetworkListener.removeNetworkElementPost(INetworkElement, BlockState, BlockEntity).
      Specified by:
      onPostRemoved in interface INetworkElement
      Parameters:
      network - The network.
    • onNeighborBlockChange

      public void onNeighborBlockChange(@Nullable INetwork network, net.minecraft.world.level.BlockGetter world)
      Description copied from interface: INetworkElement
      Called when a neighbouring block is updated, more specifically when BlockBehaviour.neighborChanged(BlockState, Level, BlockPos, Block, Orientation, boolean), IBlockExtension.onNeighborChange(BlockState, LevelReader, BlockPos, BlockPos) or BlockBehaviour.updateShape(BlockState, LevelReader, ScheduledTickAccess, BlockPos, Direction, BlockPos, BlockState, RandomSource) is called.
      Specified by:
      onNeighborBlockChange in interface INetworkElement
      Parameters:
      network - The network to update in.
      world - The world in which the neighbour was updated.
    • invalidate

      public void invalidate(INetwork network)
      Description copied from interface: INetworkElement
      Invalidate this network element.
      Specified by:
      invalidate in interface INetworkElement
      Parameters:
      network - The network.
    • revalidate

      public void revalidate(INetwork network)
      Description copied from interface: INetworkElement
      Revalidate this network element after it has been invalidated.
      Specified by:
      revalidate in interface INetworkElement
      Parameters:
      network - The network.
    • canRevalidatePositioned

      protected boolean canRevalidatePositioned(INetwork network, org.cyclops.cyclopscore.datastructure.DimPos dimPos)
    • revalidatePositioned

      protected void revalidatePositioned(INetwork network, org.cyclops.cyclopscore.datastructure.DimPos dimPos)