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 class
An 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 TypeMethodDescriptionvoid
addGlobalError
(net.minecraft.network.chat.Component error) Add a global error message.void
deserialize
(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.SimpleInventory
getVariable
(INetwork network, IPartNetwork partNetwork, ValueDeseralizationContext valueDeseralizationContext) Get the active variable in this state.boolean
protected void
void
onVariableContentsUpdated
(P partType, PartTarget target) Refresh the current variable to have its current info reset and updated.void
serialize
(net.minecraft.world.level.storage.ValueOutput valueOutput) Write a state to NBT.protected void
validate
(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, writeAspectProperties
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:IPartState
Write a state to NBT.- Specified by:
serialize
in interfaceIPartState<P extends IPartType>
- Overrides:
serialize
in 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:IPartState
Read a state from NBT.- Specified by:
deserialize
in interfaceIPartState<P extends IPartType>
- Overrides:
deserialize
in 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:IPartState
Get the given capability.- Specified by:
getCapability
in interfaceIPartState<P extends IPartType>
- Overrides:
getCapability
in 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.
-