Class PartStateActiveVariableBase<P extends IPartType>
java.lang.Object
org.cyclops.integrateddynamics.core.part.PartStateBase<P>
org.cyclops.integrateddynamics.core.part.PartStateActiveVariableBase<P>
- All Implemented Interfaces:
org.cyclops.cyclopscore.persist.IDirtyMarkListener,IPartState<P>
- Direct Known Subclasses:
PartStateWriterBase,PartTypePanelVariableDriven.State
An abstract part state with a focus on activatable variables.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn inventory that can only hold one filled slot at a time.static class -
Field Summary
FieldsFields inherited from interface org.cyclops.integrateddynamics.api.part.IPartState
GLOBALCOUNTER_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddGlobalError(net.minecraft.network.chat.MutableComponent error) Add a global error message.<T> net.minecraftforge.common.util.LazyOptional<T>getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, INetwork network, IPartNetwork partNetwork, PartTarget target) Get the given capability.List<net.minecraft.network.chat.MutableComponent>org.cyclops.cyclopscore.inventory.SimpleInventorygetVariable(INetwork network, IPartNetwork partNetwork) Get the active variable in this state.booleanprotected voidvoidonVariableContentsUpdated(P partType, PartTarget target) Refresh the current variable to have its current info reset and updated.voidreadFromNBT(net.minecraft.nbt.CompoundTag tag) Read a state from NBT.protected voidvalidate(INetwork network, IPartNetwork partNetwork) voidwriteToNBT(net.minecraft.nbt.CompoundTag tag) Write a state to NBT.Methods inherited from class org.cyclops.integrateddynamics.core.part.PartStateBase
addVolatileCapability, clearInventoriesNamed, forceBlockRenderUpdate, gatherCapabilities, generateId, getAspectProperties, getChannel, getDefaultUpdateInterval, getId, getInventoriesNamed, getInventoryNamed, getMaxOffset, getOffsetVariableError, getPriority, getTargetOffset, getTargetSideOverride, getUpdateInterval, initializeOffsets, isDirtyAndReset, isEnabled, isForceBlockRenderUpdateAndReset, isUpdateAndReset, markDirty, markOffsetVariablesChanged, onDirty, readAspectProperties, removeVolatileCapability, requiresOffsetUpdates, sendUpdate, setAspectProperties, setChannel, setEnabled, setInventoryNamed, setMaxOffset, setPriority, setTargetOffset, setTargetSideOverride, setUpdateInterval, updateOffsetVariables, writeAspectPropertiesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.cyclops.integrateddynamics.api.part.IPartState
loadInventoryNamed, saveInventoryNamed
-
Field Details
-
currentVariableFacade
-
-
Constructor Details
-
PartStateActiveVariableBase
public PartStateActiveVariableBase(int inventorySize)
-
-
Method Details
-
getInventory
public org.cyclops.cyclopscore.inventory.SimpleInventory getInventory()- Returns:
- The inner inventory
-
validate
-
onCorruptedState
protected void onCorruptedState() -
hasVariable
public boolean hasVariable()- Returns:
- If there is an active variable present for this state.
-
getVariable
Get the active variable in this state.- Type Parameters:
V- The variable value type.- Parameters:
network- The network.partNetwork- The part network.- Returns:
- The variable.
-
onVariableContentsUpdated
Refresh the current variable to have its current info reset and updated.- Parameters:
partType- The corresponding part type.target- The target of the part.
-
getGlobalErrors
- Returns:
- All global error messages.
-
addGlobalError
public void addGlobalError(net.minecraft.network.chat.MutableComponent error) Add a global error message.- Parameters:
error- The message to add.
-
writeToNBT
public void writeToNBT(net.minecraft.nbt.CompoundTag tag) Description copied from interface:IPartStateWrite a state to NBT.- Specified by:
writeToNBTin interfaceIPartState<P extends IPartType>- Overrides:
writeToNBTin classPartStateBase<P extends IPartType>- Parameters:
tag- The tag to write to.
-
readFromNBT
public void readFromNBT(net.minecraft.nbt.CompoundTag tag) Description copied from interface:IPartStateRead a state from NBT.- Specified by:
readFromNBTin interfaceIPartState<P extends IPartType>- Overrides:
readFromNBTin classPartStateBase<P extends IPartType>- Parameters:
tag- The tag to read from.
-
getCapability
public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, INetwork network, IPartNetwork partNetwork, PartTarget target) Description copied from interface:IPartStateGet the given capability.- Specified by:
getCapabilityin interfaceIPartState<P extends IPartType>- Overrides:
getCapabilityin classPartStateBase<P extends IPartType>- Type Parameters:
T- The capability type.- Parameters:
capability- The capability to get.network- The network the part belongs to.partNetwork- The part network the part belongs to.target- The target.- Returns:
- The optional capability instance.
-