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 ClassesNested 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
currentVariableFacadeFields inherited from interface org.cyclops.integrateddynamics.api.part.IPartState
GLOBALCOUNTER_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddError(IAspectWrite aspect, net.minecraft.network.chat.MutableComponent error) Set the current error for the given aspect.booleanIf this state is at its first tick, will be reset after calling this.voiddeserialize(net.minecraft.world.level.storage.ValueInput valueInput) Read a state from NBT.List<net.minecraft.network.chat.Component> getErrors(IAspectWrite aspect) Get the current error for the given aspect.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.voidtriggerAspectInfoUpdate(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 voidvalidate(INetwork network, IPartNetwork partNetwork) Methods inherited from class org.cyclops.integrateddynamics.core.part.PartStateActiveVariableBase
addGlobalError, getCapability, getGlobalErrors, getInventory, getVariableMethods 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
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, updateOffsetVariablesMethods inherited from interface org.cyclops.integrateddynamics.api.part.write.IPartStateWriter
getInventory, getVariable, isDeactivated, setDeactivated
-
Constructor Details
-
PartStateWriterBase
public PartStateWriterBase(int inventorySize)
-
-
Method Details
-
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 IPartTypeWriter>- Overrides:
serializein classPartStateActiveVariableBase<P extends IPartTypeWriter>- 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 IPartTypeWriter>- Overrides:
deserializein classPartStateActiveVariableBase<P extends IPartTypeWriter>- Parameters:
valueInput- The value to read from.
-
validate
- Overrides:
validatein classPartStateActiveVariableBase<P extends IPartTypeWriter>
-
onCorruptedState
protected void onCorruptedState()- Overrides:
onCorruptedStatein classPartStateActiveVariableBase<P extends IPartTypeWriter>
-
hasVariable
public boolean hasVariable()- Specified by:
hasVariablein interfaceIPartStateWriter<P extends IPartTypeWriter>- Overrides:
hasVariablein 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:IPartStateWriterIndicate 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:
triggerAspectInfoUpdatein 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:PartStateActiveVariableBaseRefresh the current variable to have its current info reset and updated.- Specified by:
onVariableContentsUpdatedin interfaceIPartStateWriter<P extends IPartTypeWriter>- Overrides:
onVariableContentsUpdatedin classPartStateActiveVariableBase<P extends IPartTypeWriter>- Parameters:
partType- The corresponding part type.target- The target of the part.
-
getActiveAspect
- Specified by:
getActiveAspectin interfaceIPartStateWriter<P extends IPartTypeWriter>- Returns:
- The currently active aspect for this part, can be null.
-
getErrors
Description copied from interface:IPartStateWriterGet the current error for the given aspect.- Specified by:
getErrorsin 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:IPartStateWriterSet the current error for the given aspect.- Specified by:
addErrorin 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:IPartStateWriterIf this state is at its first tick, will be reset after calling this.- Specified by:
checkAndResetFirstTickin interfaceIPartStateWriter<P extends IPartTypeWriter>- Returns:
- If this is the first time this state is ticking.
-