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
Modifier and TypeClassDescriptionstatic class
An inventory that can only hold one filled slot at a time.static class
-
Field Summary
Fields inherited from interface org.cyclops.integrateddynamics.api.part.IPartState
GLOBALCOUNTER_KEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addGlobalError
(net.minecraft.network.chat.MutableComponent error) Add a global error message.<T> Optional
<T> getCapability
(P partType, PartCapability<T> capability, INetwork network, IPartNetwork partNetwork, PartTarget target) Get the given capability.List
<net.minecraft.network.chat.MutableComponent> 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
readFromNBT
(ValueDeseralizationContext valueDeseralizationContext, net.minecraft.nbt.CompoundTag tag) Read a state from NBT.protected void
validate
(INetwork network, IPartNetwork partNetwork) void
writeToNBT
(ValueDeseralizationContext valueDeseralizationContext, 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, 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.MutableComponent error) Add a global error message.- Parameters:
error
- The message to add.
-
writeToNBT
public void writeToNBT(ValueDeseralizationContext valueDeseralizationContext, net.minecraft.nbt.CompoundTag tag) Description copied from interface:IPartState
Write a state to NBT.- Specified by:
writeToNBT
in interfaceIPartState<P extends IPartType>
- Overrides:
writeToNBT
in classPartStateBase<P extends IPartType>
- Parameters:
valueDeseralizationContext
-tag
- The tag to write to.
-
readFromNBT
public void readFromNBT(ValueDeseralizationContext valueDeseralizationContext, net.minecraft.nbt.CompoundTag tag) Description copied from interface:IPartState
Read a state from NBT.- Specified by:
readFromNBT
in interfaceIPartState<P extends IPartType>
- Overrides:
readFromNBT
in classPartStateBase<P extends IPartType>
- Parameters:
valueDeseralizationContext
- Getter for blocks.tag
- The tag 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.
-