Interface IPartStateWriter<P extends IPartTypeWriter>

All Superinterfaces:
IPartState<P>
All Known Implementing Classes:
PartStateWriterBase

public interface IPartStateWriter<P extends IPartTypeWriter> extends IPartState<P>
A value holder for an IPartTypeWriter. This is what will be serialized from and to NBT. This object is mutable and should not be recreated.
  • Method Details

    • getInventory

      org.cyclops.cyclopscore.inventory.SimpleInventory getInventory()
      Returns:
      The inventory for this state.
    • hasVariable

      boolean hasVariable()
      Returns:
      If there is an active variable present for this state.
    • getVariable

      <V extends IValue> IVariable<V> getVariable(INetwork network, IPartNetwork partNetwork, ValueDeseralizationContext valueDeseralizationContext)
      Get the current target variable.
      Type Parameters:
      V - The value type.
      Parameters:
      network - The network this part belongs to.
      partNetwork - The part network this part belongs to.
      valueDeseralizationContext - The value deserialization context.
      Returns:
      The active variable to read from.
    • triggerAspectInfoUpdate

      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.
      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

      void onVariableContentsUpdated(P partType, PartTarget target)
      Called when this part should refresh its state. When for example some variables in the network are changed.
      Parameters:
      partType - The part type.
      target - The target.
    • getActiveAspect

      @Nullable IAspectWrite getActiveAspect()
      Returns:
      The currently active aspect for this part, can be null.
    • getErrors

      List<net.minecraft.network.chat.MutableComponent> getErrors(IAspectWrite aspect)
      Get the current error for the given aspect.
      Parameters:
      aspect - The aspect to get the error from.
      Returns:
      The current error, can be empty.
    • addError

      void addError(IAspectWrite aspect, net.minecraft.network.chat.MutableComponent error)
      Set the current error for the given aspect.
      Parameters:
      aspect - The aspect to set the error for.
      error - The error to set, or null to clear.
    • isDeactivated

      boolean isDeactivated()
      Returns:
      If this part has been deactivated.
    • setDeactivated

      void setDeactivated(boolean deactivated)
      Used to avoid calling deactivation logic more than once when updating aspects.
      Parameters:
      deactivated - If this part should be deactivated.
    • checkAndResetFirstTick

      boolean checkAndResetFirstTick()
      If this state is at its first tick, will be reset after calling this.
      Returns:
      If this is the first time this state is ticking.