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
Base implementation for a network element.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDrops
(List<net.minecraft.world.item.ItemStack> itemStacks, boolean dropMainElement, boolean saveState) Add the itemstacks to drop when this element is removed.void
afterNetworkAlive
(INetwork network) Called right after this network is initialized.void
afterNetworkReAlive
(INetwork network) Called right after this network has come alive again, for example after a network restart.void
beforeNetworkKill
(INetwork network) 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
(INetwork network) Invalidate this network element.boolean
isUpdate()
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 whenBlockBehaviour.neighborChanged(BlockState, Level, BlockPos, Block, BlockPos, boolean)
,IForgeBlock.onNeighborChange(BlockState, LevelReader, BlockPos, BlockPos)
orBlockBehaviour.updateShape(BlockState, Direction, BlockState, LevelAccessor, BlockPos, BlockPos)
is called.boolean
onNetworkAddition
(INetwork network) Called when this element is added to the network.void
onNetworkRemoval
(INetwork network) Called when this element is removed from the network.void
onPostRemoved
(INetwork network) Called when this element has been removed.void
onPreRemoved
(INetwork network) Called when this element is about to be removed.void
revalidate
(INetwork network) Revalidate this network element after it has been invalidated.protected void
revalidatePositioned
(INetwork network, org.cyclops.cyclopscore.datastructure.DimPos dimPos) void
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, setPriorityAndChannel
-
Constructor Details
-
NetworkElementBase
public NetworkElementBase()
-
-
Method Details
-
getUpdateInterval
public int getUpdateInterval()- Specified by:
getUpdateInterval
in interfaceINetworkElement
- Returns:
- The tick interval to update this element.
-
isUpdate
public boolean isUpdate()- Specified by:
isUpdate
in interfaceINetworkElement
- Returns:
- If this element should be updated. This method is only called once during network initialization.
-
update
Description copied from interface:INetworkElement
Update at the tick interval specified.- Specified by:
update
in interfaceINetworkElement
- Parameters:
network
- The network to update in.
-
beforeNetworkKill
Description copied from interface:INetworkElement
Called right before the network is terminated or will be reset.- Specified by:
beforeNetworkKill
in interfaceINetworkElement
- Parameters:
network
- The network to update in.
-
afterNetworkAlive
Description copied from interface:INetworkElement
Called right after this network is initialized.- Specified by:
afterNetworkAlive
in interfaceINetworkElement
- Parameters:
network
- The network to update in.
-
afterNetworkReAlive
Description copied from interface:INetworkElement
Called right after this network has come alive again, for example after a network restart.- Specified by:
afterNetworkReAlive
in interfaceINetworkElement
- Parameters:
network
- The network to update in.
-
addDrops
public void addDrops(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 interfaceINetworkElement
- 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
Description copied from interface:INetworkElement
Called when this element is added to the network.- Specified by:
onNetworkAddition
in interfaceINetworkElement
- Parameters:
network
- The network.- Returns:
- If the addition succeeded.
-
onNetworkRemoval
Description copied from interface:INetworkElement
Called when this element is removed from the network.- Specified by:
onNetworkRemoval
in interfaceINetworkElement
- Parameters:
network
- The network.
-
onPreRemoved
Description copied from interface:INetworkElement
Called when this element is about to be removed. This is called beforeIFullNetworkListener.removeNetworkElementPre(INetworkElement)
.- Specified by:
onPreRemoved
in interfaceINetworkElement
- Parameters:
network
- The network.
-
onPostRemoved
Description copied from interface:INetworkElement
Called when this element has been removed. This is called afterIFullNetworkListener.removeNetworkElementPost(INetworkElement)
.- Specified by:
onPostRemoved
in interfaceINetworkElement
- Parameters:
network
- The network.
-
onNeighborBlockChange
public void onNeighborBlockChange(@Nullable INetwork network, net.minecraft.world.level.BlockGetter world, net.minecraft.world.level.block.Block neighbourBlock, net.minecraft.core.BlockPos neighbourBlockPos) Description copied from interface:INetworkElement
Called when a neighbouring block is updated, more specifically whenBlockBehaviour.neighborChanged(BlockState, Level, BlockPos, Block, BlockPos, boolean)
,IForgeBlock.onNeighborChange(BlockState, LevelReader, BlockPos, BlockPos)
orBlockBehaviour.updateShape(BlockState, Direction, BlockState, LevelAccessor, BlockPos, BlockPos)
is called.- Specified by:
onNeighborBlockChange
in interfaceINetworkElement
- 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.
-
invalidate
Description copied from interface:INetworkElement
Invalidate this network element.- Specified by:
invalidate
in interfaceINetworkElement
- Parameters:
network
- The network.
-
revalidate
Description copied from interface:INetworkElement
Revalidate this network element after it has been invalidated.- Specified by:
revalidate
in interfaceINetworkElement
- 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)
-