Class PartStateWriterBase<P extends IPartTypeWriter>
java.lang.Object
org.cyclops.integrateddynamics.core.part.PartStateBase<P>
org.cyclops.integrateddynamics.core.part.PartStateActiveVariableBase<P>
org.cyclops.integrateddynamics.core.part.write.PartStateWriterBase<P>
- All Implemented Interfaces:
org.cyclops.cyclopscore.persist.IDirtyMarkListener
,IPartState<P>
,IPartStateWriter<P>
public class PartStateWriterBase<P extends IPartTypeWriter>
extends PartStateActiveVariableBase<P>
implements IPartStateWriter<P>
A default implementation of the
IPartTypeWriter
.-
Nested Class Summary
Nested classes/interfaces inherited from class org.cyclops.integrateddynamics.core.part.PartStateActiveVariableBase
PartStateActiveVariableBase.SingularInventory
-
Field Summary
Fields inherited from class org.cyclops.integrateddynamics.core.part.PartStateActiveVariableBase
currentVariableFacade
Fields inherited from interface org.cyclops.integrateddynamics.api.part.IPartState
GLOBALCOUNTER_KEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addError
(IAspectWrite aspect, net.minecraft.network.chat.MutableComponent error) Set the current error for the given aspect.boolean
If this state is at its first tick, will be reset after calling this.List<net.minecraft.network.chat.MutableComponent>
getErrors
(IAspectWrite aspect) Get the current error for the given aspect.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.void
triggerAspectInfoUpdate
(P partType, PartTarget target, IAspectWrite newAspect, boolean isNetworkInitializing) Indicate that this state should eventually recheck its aspect info because something might have changed what can cause the active variable to be referring to something else.protected void
validate
(INetwork network, IPartNetwork partNetwork) void
writeToNBT
(net.minecraft.nbt.CompoundTag tag) Write a state to NBT.Methods inherited from class org.cyclops.integrateddynamics.core.part.PartStateActiveVariableBase
addGlobalError, getCapability, getGlobalErrors, getInventory, getVariable
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
addVolatileCapability, clearInventoriesNamed, forceBlockRenderUpdate, gatherCapabilities, generateId, getAspectProperties, getCapability, getChannel, getId, getInventoriesNamed, getInventoryNamed, getMaxOffset, getOffsetVariableError, getPriority, getTargetOffset, getTargetSideOverride, getUpdateInterval, initializeOffsets, isDirtyAndReset, isEnabled, isForceBlockRenderUpdateAndReset, isUpdateAndReset, loadInventoryNamed, markDirty, markOffsetVariablesChanged, removeVolatileCapability, requiresOffsetUpdates, saveInventoryNamed, setAspectProperties, setChannel, setEnabled, setInventoryNamed, setMaxOffset, setPriority, setTargetOffset, setTargetSideOverride, setUpdateInterval, updateOffsetVariables
Methods inherited from interface org.cyclops.integrateddynamics.api.part.write.IPartStateWriter
getInventory, getVariable, isDeactivated, setDeactivated
-
Constructor Details
-
PartStateWriterBase
public PartStateWriterBase(int inventorySize)
-
-
Method Details
-
writeToNBT
public void writeToNBT(net.minecraft.nbt.CompoundTag tag) Description copied from interface:IPartState
Write a state to NBT.- Specified by:
writeToNBT
in interfaceIPartState<P extends IPartTypeWriter>
- Overrides:
writeToNBT
in classPartStateActiveVariableBase<P extends IPartTypeWriter>
- Parameters:
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 IPartTypeWriter>
- Overrides:
readFromNBT
in classPartStateActiveVariableBase<P extends IPartTypeWriter>
- Parameters:
valueDeseralizationContext
- Getter for blocks.tag
- The tag to read from.
-
validate
- Overrides:
validate
in classPartStateActiveVariableBase<P extends IPartTypeWriter>
-
onCorruptedState
protected void onCorruptedState()- Overrides:
onCorruptedState
in classPartStateActiveVariableBase<P extends IPartTypeWriter>
-
hasVariable
public boolean hasVariable()- Specified by:
hasVariable
in interfaceIPartStateWriter<P extends IPartTypeWriter>
- Overrides:
hasVariable
in classPartStateActiveVariableBase<P extends IPartTypeWriter>
- Returns:
- If there is an active variable present for this state.
-
triggerAspectInfoUpdate
public void triggerAspectInfoUpdate(P partType, PartTarget target, IAspectWrite newAspect, boolean isNetworkInitializing) Description copied from interface:IPartStateWriter
Indicate that this state should eventually recheck its aspect info because something might have changed what can cause the active variable to be referring to something else.- Specified by:
triggerAspectInfoUpdate
in interfaceIPartStateWriter<P extends IPartTypeWriter>
- Parameters:
partType
- The part type.target
- The target.newAspect
- The new active aspect, can be null.isNetworkInitializing
- If this method is being invoked during network (de)initializing.
-
onVariableContentsUpdated
Description copied from class:PartStateActiveVariableBase
Refresh the current variable to have its current info reset and updated.- Specified by:
onVariableContentsUpdated
in interfaceIPartStateWriter<P extends IPartTypeWriter>
- Overrides:
onVariableContentsUpdated
in classPartStateActiveVariableBase<P extends IPartTypeWriter>
- Parameters:
partType
- The corresponding part type.target
- The target of the part.
-
getActiveAspect
- Specified by:
getActiveAspect
in interfaceIPartStateWriter<P extends IPartTypeWriter>
- Returns:
- The currently active aspect for this part, can be null.
-
getErrors
Description copied from interface:IPartStateWriter
Get the current error for the given aspect.- Specified by:
getErrors
in interfaceIPartStateWriter<P extends IPartTypeWriter>
- Parameters:
aspect
- The aspect to get the error from.- Returns:
- The current error, can be empty.
-
addError
Description copied from interface:IPartStateWriter
Set the current error for the given aspect.- Specified by:
addError
in interfaceIPartStateWriter<P extends IPartTypeWriter>
- Parameters:
aspect
- The aspect to set the error for.error
- The error to set, or null to clear.
-
checkAndResetFirstTick
public boolean checkAndResetFirstTick()Description copied from interface:IPartStateWriter
If this state is at its first tick, will be reset after calling this.- Specified by:
checkAndResetFirstTick
in interfaceIPartStateWriter<P extends IPartTypeWriter>
- Returns:
- If this is the first time this state is ticking.
-