Class SingleFluidStorage

All Implemented Interfaces:
SingleSlotStorage<FluidVariant>, Storage<FluidVariant>, StorageView<FluidVariant>, TransactionContext.CloseCallback, TransactionContext.OuterCloseCallback

@Experimental @Deprecated(forRemoval=true) public abstract class SingleFluidStorage extends SnapshotParticipant<ResourceAmount<FluidVariant>> implements SingleSlotStorage<FluidVariant>
Deprecated, for removal: This API element is subject to removal in a future version.
Superseded by SingleVariantStorage. Will be removed in a future iteration of the API.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    long
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    canExtract(FluidVariant fluidVariant)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected boolean
    canInsert(FluidVariant fluidVariant)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected final ResourceAmount<FluidVariant>
    Deprecated, for removal: This API element is subject to removal in a future version.
    Return a new nonnull object containing the current state of this participant.
    final long
    extract(FluidVariant extractedFluid, long maxAmount, TransactionContext transaction)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Try to extract up to some amount of a resource from this storage.
    final long
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    final long
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected abstract long
    getCapacity(FluidVariant fluidVariant)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    final long
    insert(FluidVariant insertedFluid, long maxAmount, TransactionContext transaction)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Try to insert up to some amount of a resource into this storage.
    final boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    Return true if the StorageView.getResource() contained in this storage view is blank, or false otherwise.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Implement if you want.
    protected final void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Called after an outer transaction succeeded, to perform irreversible actions such as markDirty() or neighbor updates.
    protected final void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Roll back to a state previously created by SnapshotParticipant.createSnapshot().

    Methods inherited from class net.fabricmc.fabric.api.transfer.v1.transaction.base.SnapshotParticipant

    afterOuterClose, onClose, releaseSnapshot, updateSnapshots

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.fabricmc.fabric.api.transfer.v1.storage.base.SingleSlotStorage

    iterator

    Methods inherited from interface net.fabricmc.fabric.api.transfer.v1.storage.Storage

    exactView, getVersion, iterable, simulateExtract, simulateInsert, supportsExtraction, supportsInsertion

    Methods inherited from interface net.fabricmc.fabric.api.transfer.v1.storage.StorageView

    getUnderlyingView
  • Field Details

    • fluidVariant

      public FluidVariant fluidVariant
      Deprecated, for removal: This API element is subject to removal in a future version.
    • amount

      public long amount
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Constructor Details

    • SingleFluidStorage

      public SingleFluidStorage()
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • markDirty

      protected void markDirty()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Implement if you want.
    • canInsert

      protected boolean canInsert(FluidVariant fluidVariant)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns:
      true if the passed non-blank fluid variant can be inserted, false otherwise.
    • canExtract

      protected boolean canExtract(FluidVariant fluidVariant)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns:
      true if the passed non-blank fluid variant can be extracted, false otherwise.
    • getCapacity

      protected abstract long getCapacity(FluidVariant fluidVariant)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns:
      The maximum capacity of this storage for the passed fluid variant. If the passed fluid variant is blank, an estimate should be returned.
    • isResourceBlank

      public final boolean isResourceBlank()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: StorageView
      Return true if the StorageView.getResource() contained in this storage view is blank, or false otherwise.

      This function is mostly useful when dealing with storages of arbitrary types. For transfer variant storages, this should always be equivalent to getResource().isBlank().

      Specified by:
      isResourceBlank in interface StorageView<FluidVariant>
    • getResource

      public final FluidVariant getResource()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getResource in interface StorageView<FluidVariant>
      Returns:
      The resource stored in this view. May not be blank if StorageView.isResourceBlank() is false.
    • getAmount

      public final long getAmount()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getAmount in interface StorageView<FluidVariant>
      Returns:
      The amount of StorageView.getResource() stored in this view.
    • getCapacity

      public final long getCapacity()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getCapacity in interface StorageView<FluidVariant>
      Returns:
      The total amount of StorageView.getResource() that could be stored in this view, or an estimate of the number of resources that could be stored if this view has a blank resource.
    • insert

      public final long insert(FluidVariant insertedFluid, long maxAmount, TransactionContext transaction)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Storage
      Try to insert up to some amount of a resource into this storage.
      Specified by:
      insert in interface Storage<FluidVariant>
      Parameters:
      insertedFluid - The resource to insert. May not be blank.
      maxAmount - The maximum amount of resource to insert. May not be negative.
      transaction - The transaction this operation is part of.
      Returns:
      A nonnegative integer not greater than maxAmount: the amount that was inserted.
    • extract

      public final long extract(FluidVariant extractedFluid, long maxAmount, TransactionContext transaction)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Storage
      Try to extract up to some amount of a resource from this storage.
      Specified by:
      extract in interface Storage<FluidVariant>
      Specified by:
      extract in interface StorageView<FluidVariant>
      Parameters:
      extractedFluid - The resource to extract. May not be blank.
      maxAmount - The maximum amount of resource to extract. May not be negative.
      transaction - The transaction this operation is part of.
      Returns:
      A nonnegative integer not greater than maxAmount: the amount that was extracted.
    • createSnapshot

      protected final ResourceAmount<FluidVariant> createSnapshot()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from class: SnapshotParticipant
      Return a new nonnull object containing the current state of this participant. null may not be returned, or an exception will be thrown!
      Specified by:
      createSnapshot in class SnapshotParticipant<ResourceAmount<FluidVariant>>
    • readSnapshot

      protected final void readSnapshot(ResourceAmount<FluidVariant> snapshot)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from class: SnapshotParticipant
      Roll back to a state previously created by SnapshotParticipant.createSnapshot().
      Specified by:
      readSnapshot in class SnapshotParticipant<ResourceAmount<FluidVariant>>
    • onFinalCommit

      protected final void onFinalCommit()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from class: SnapshotParticipant
      Called after an outer transaction succeeded, to perform irreversible actions such as markDirty() or neighbor updates.
      Overrides:
      onFinalCommit in class SnapshotParticipant<ResourceAmount<FluidVariant>>