Class PartNetwork
java.lang.Object
org.cyclops.integrateddynamics.api.network.FullNetworkListenerAdapter
org.cyclops.integrateddynamics.core.network.PartNetwork
- All Implemented Interfaces:
ILazyExpressionValueCache,IFullNetworkListener,IPartNetwork
A network that can hold parts.
Note that this network only contains references to the relevant data, it does not contain the actual information.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdd the given part state to the network.booleanaddProxy(int proxyId, org.cyclops.cyclopscore.datastructure.DimPos dimPos) Add the given proxy to the network.booleanaddVariableContainer(org.cyclops.cyclopscore.datastructure.DimPos dimPos) Add the position of a variable container.getPartState(int partId) Get the part state by id from this network.getPartType(int partId) Get the part by id from this network.getPartVariable(int partId, IAspectRead<V, ?> aspect) Get the current variable from the aspect of the given part id.org.cyclops.cyclopscore.datastructure.DimPosgetProxy(int proxyId) Check if this network contains the given part id.getValue(int id) protected Map<Integer, IVariableFacade> getVariableFacade(int variableId) Get the variable facade with given variable id.booleanhasPart(int partId) Check if this network contains the given part id.<V extends IValue>
booleanhasPartVariable(int partId, IAspectRead<V, ?> aspect) Check if a variable can be found for a given part and aspect.booleanhasValue(int id) booleanhasVariableFacade(int variableId) Check if this network has access to the variable facade with given variable id.voidinvalidateElement(INetworkElement element) Invalidate the given element.voidTell the network to recheck all parts next update round.voidremovePart(int partId) Remove the part state by id from this network.booleanremovePathElement(IPathElement pathElement, net.minecraft.core.Direction side, net.minecraft.world.level.block.state.BlockState blockState, net.minecraft.world.level.block.entity.BlockEntity blockEntity) Remove the given path element from the network.voidremoveProxy(int proxyId) Remove the proxy by id from this network.voidremoveValue(int id) voidremoveVariableContainer(org.cyclops.cyclopscore.datastructure.DimPos dimPos) Remove the position of a variable container.voidrevalidateElement(INetworkElement element) Revalidate the given element.voidvoidupdate()This network updating should be called each tick.Methods inherited from class org.cyclops.integrateddynamics.api.network.FullNetworkListenerAdapter
addNetworkElement, afterServerLoad, beforeServerStop, canUpdate, kill, onSkipUpdate, postUpdate, removeNetworkElementPost, removeNetworkElementPre, updateGuaranteed
-
Constructor Details
-
PartNetwork
public PartNetwork()
-
-
Method Details
-
addPart
Description copied from interface:IPartNetworkAdd the given part state to the network.- Specified by:
addPartin interfaceIPartNetwork- Parameters:
partId- The id of the part.partPos- The part position to add.- Returns:
- If the addition was successful.
-
getPartState
Description copied from interface:IPartNetworkGet the part state by id from this network.- Specified by:
getPartStatein interfaceIPartNetwork- Parameters:
partId- The part state id.- Returns:
- The corresponding part state or null.
-
getPartType
Description copied from interface:IPartNetworkGet the part by id from this network.- Specified by:
getPartTypein interfaceIPartNetwork- Parameters:
partId- The part state id.- Returns:
- The corresponding part or null.
-
removePart
public void removePart(int partId) Description copied from interface:IPartNetworkRemove the part state by id from this network.- Specified by:
removePartin interfaceIPartNetwork- Parameters:
partId- The part state id.
-
hasPart
public boolean hasPart(int partId) Description copied from interface:IPartNetworkCheck if this network contains the given part id.- Specified by:
hasPartin interfaceIPartNetwork- Parameters:
partId- The part state id.- Returns:
- If this part is present in this network.
-
hasPartVariable
Description copied from interface:IPartNetworkCheck if a variable can be found for a given part and aspect.- Specified by:
hasPartVariablein interfaceIPartNetwork- Type Parameters:
V- The value.- Parameters:
partId- The part state id.aspect- The aspect from the given part.- Returns:
- True if such a variable can be found. False if the given part is not present in the network or if the given aspect is not present at that part.
-
getPartVariable
Description copied from interface:IPartNetworkGet the current variable from the aspect of the given part id. This method can call a NPE or cast exception when the given part does not exists, so make sure to check this before.- Specified by:
getPartVariablein interfaceIPartNetwork- Type Parameters:
V- The value.- Parameters:
partId- The part state id.aspect- The aspect from the given part.- Returns:
- The variable.
-
getVariableCache
-
hasVariableFacade
public boolean hasVariableFacade(int variableId) Description copied from interface:IPartNetworkCheck if this network has access to the variable facade with given variable id.- Specified by:
hasVariableFacadein interfaceIPartNetwork- Parameters:
variableId- The variable id.- Returns:
- If this network has access to it.
-
getVariableFacade
Description copied from interface:IPartNetworkGet the variable facade with given variable id.- Specified by:
getVariableFacadein interfaceIPartNetwork- Parameters:
variableId- The variable id.- Returns:
- The variable facade.
-
setValue
- Specified by:
setValuein interfaceILazyExpressionValueCache
-
hasValue
public boolean hasValue(int id) - Specified by:
hasValuein interfaceILazyExpressionValueCache
-
getValue
- Specified by:
getValuein interfaceILazyExpressionValueCache
-
removeValue
public void removeValue(int id) - Specified by:
removeValuein interfaceILazyExpressionValueCache
-
addVariableContainer
public boolean addVariableContainer(org.cyclops.cyclopscore.datastructure.DimPos dimPos) Description copied from interface:IPartNetworkAdd the position of a variable container.- Specified by:
addVariableContainerin interfaceIPartNetwork- Parameters:
dimPos- The variable container position.- Returns:
- If the container did not exist in the network already.
-
removeVariableContainer
public void removeVariableContainer(org.cyclops.cyclopscore.datastructure.DimPos dimPos) Description copied from interface:IPartNetworkRemove the position of a variable container.- Specified by:
removeVariableContainerin interfaceIPartNetwork- Parameters:
dimPos- The variable container position.
-
addProxy
public boolean addProxy(int proxyId, org.cyclops.cyclopscore.datastructure.DimPos dimPos) Description copied from interface:IPartNetworkAdd the given proxy to the network.- Specified by:
addProxyin interfaceIPartNetwork- Parameters:
proxyId- The id of the proxy.dimPos- The proxy position.- Returns:
- If the addition was successful.
-
removeProxy
public void removeProxy(int proxyId) Description copied from interface:IPartNetworkRemove the proxy by id from this network.- Specified by:
removeProxyin interfaceIPartNetwork- Parameters:
proxyId- The id of the proxy.
-
getProxy
public org.cyclops.cyclopscore.datastructure.DimPos getProxy(int proxyId) Description copied from interface:IPartNetworkCheck if this network contains the given part id.- Specified by:
getProxyin interfaceIPartNetwork- Parameters:
proxyId- The id of the proxy.- Returns:
- The proxy position.
-
notifyPartsChanged
public void notifyPartsChanged()Description copied from interface:IPartNetworkTell the network to recheck all parts next update round.- Specified by:
notifyPartsChangedin interfaceIPartNetwork
-
update
public void update()Description copied from interface:IFullNetworkListenerThis network updating should be called each tick.- Specified by:
updatein interfaceIFullNetworkListener- Overrides:
updatein classFullNetworkListenerAdapter
-
removePathElement
public boolean removePathElement(IPathElement pathElement, net.minecraft.core.Direction side, net.minecraft.world.level.block.state.BlockState blockState, net.minecraft.world.level.block.entity.BlockEntity blockEntity) Description copied from interface:IFullNetworkListenerRemove the given path element from the network. If the path element had any network elements registered in the network, these will be killed and removed as well.- Specified by:
removePathElementin interfaceIFullNetworkListener- Overrides:
removePathElementin classFullNetworkListenerAdapter- Parameters:
pathElement- The path element.side- The side.blockState- The block state container.blockEntity-- Returns:
- If the path element was removed.
-
invalidateElement
Description copied from interface:IFullNetworkListenerInvalidate the given element. Called when the element's chunk is being unloaded.- Specified by:
invalidateElementin interfaceIFullNetworkListener- Overrides:
invalidateElementin classFullNetworkListenerAdapter- Parameters:
element- The network element to invalidate.
-
revalidateElement
Description copied from interface:IFullNetworkListenerRevalidate the given element. Called when the element's chunk is being reloaded.- Specified by:
revalidateElementin interfaceIFullNetworkListener- Overrides:
revalidateElementin classFullNetworkListenerAdapter- Parameters:
element- The network element to invalidate.
-