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.Component error) Add a global error message.voiddeserialize(net.minecraft.world.level.storage.ValueInput valueInput) Read a state from NBT.<T> Optional<T> getCapability(P partType, PartCapability<T> capability, INetwork network, IPartNetwork partNetwork, PartTarget target) Get the given capability.List<net.minecraft.network.chat.Component> org.cyclops.cyclopscore.inventory.SimpleInventorygetVariable(INetwork network, IPartNetwork partNetwork, ValueDeseralizationContext valueDeseralizationContext) 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.voidserialize(net.minecraft.world.level.storage.ValueOutput valueOutput) Write a state to NBT.protected voidvalidate(INetwork network, IPartNetwork partNetwork) 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
public <V extends IValue> IVariable<V> getVariable(INetwork network, IPartNetwork partNetwork, ValueDeseralizationContext valueDeseralizationContext) Get the active variable in this state.- Type Parameters:
V- The variable value type.- Parameters:
network- The network.partNetwork- The part network.valueDeseralizationContext-- 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.Component error) Add a global error message.- Parameters:
error- The message to add.
-
serialize
public void serialize(net.minecraft.world.level.storage.ValueOutput valueOutput) Description copied from interface:IPartStateWrite a state to NBT.- Specified by:
serializein interfaceIPartState<P extends IPartType>- Overrides:
serializein classPartStateBase<P extends IPartType>- Parameters:
valueOutput- The value to write to.
-
deserialize
public void deserialize(net.minecraft.world.level.storage.ValueInput valueInput) Description copied from interface:IPartStateRead a state from NBT.- Specified by:
deserializein interfaceIPartState<P extends IPartType>- Overrides:
deserializein classPartStateBase<P extends IPartType>- Parameters:
valueInput- The value to read from.
-
getCapability
public <T> Optional<T> getCapability(P partType, PartCapability<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:
partType- The part type.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.
-