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
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 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.boolean
canRevalidate
(INetwork network) Check if this element can be revalidated if it has been invalidated.int
int
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.void
setPriorityAndChannel
(INetwork network, int priority, int channel) Deprecated.void
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
Update at the tick interval specified.- Parameters:
network
- The network to update in.
-
beforeNetworkKill
Called right before the network is terminated or will be reset.- Parameters:
network
- The network to update in.
-
afterNetworkAlive
Called right after this network is initialized.- Parameters:
network
- The network to update in.
-
afterNetworkReAlive
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
Called when this element is added to the network.- Parameters:
network
- The network.- Returns:
- If the addition succeeded.
-
onNetworkRemoval
Called when this element is removed from the network.- Parameters:
network
- The network.
-
onPreRemoved
Called when this element is about to be removed. This is called beforeIFullNetworkListener.removeNetworkElementPre(INetworkElement)
.- Parameters:
network
- The network.
-
onPostRemoved
Called when this element has been removed. This is called afterIFullNetworkListener.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 whenBlockBehaviour.neighborChanged(BlockState, Level, BlockPos, Block, BlockPos, boolean)
,IForgeBlock.onNeighborChange(BlockState, LevelReader, BlockPos, BlockPos)
orBlockBehaviour.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.Should only be called fromINetwork.setPriorityAndChannel(INetworkElement, int, int)
!Set the priority and channel of this element in the network.- Parameters:
network
- The network this element is present in.priority
- The new prioritychannel
- 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
Invalidate this network element.- Parameters:
network
- The network.
-
canRevalidate
Check if this element can be revalidated if it has been invalidated.- Parameters:
network
- The network.- Returns:
- If it can be revalidated.
-
revalidate
Revalidate this network element after it has been invalidated.- Parameters:
network
- The network.
-
INetwork.setPriorityAndChannel(INetworkElement, int, int)
!