Class SingleFluidStorage
java.lang.Object
net.fabricmc.fabric.api.transfer.v1.transaction.base.SnapshotParticipant<ResourceAmount<FluidVariant>>
net.fabricmc.fabric.api.transfer.v1.fluid.base.SingleFluidStorage
- All Implemented Interfaces:
SingleSlotStorage<FluidVariant>
,Storage<FluidVariant>
,StorageView<FluidVariant>
,TransactionContext.CloseCallback
,TransactionContext.OuterCloseCallback
@Experimental
@ScheduledForRemoval
@Deprecated
public abstract class SingleFluidStorage
extends SnapshotParticipant<ResourceAmount<FluidVariant>>
implements SingleSlotStorage<FluidVariant>
Deprecated.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
canExtract(FluidVariant fluidVariant)
Deprecated.protected boolean
canInsert(FluidVariant fluidVariant)
Deprecated.protected ResourceAmount<FluidVariant>
Deprecated.Return a new nonnull object containing the current state of this participant.long
extract(FluidVariant extractedFluid, long maxAmount, TransactionContext transaction)
Deprecated.Try to extract up to some amount of a resource from this storage.long
Deprecated.long
Deprecated.protected abstract long
getCapacity(FluidVariant fluidVariant)
Deprecated.Deprecated.long
insert(FluidVariant insertedFluid, long maxAmount, TransactionContext transaction)
Deprecated.Try to insert up to some amount of a resource into this storage.boolean
Deprecated.Returntrue
if theStorageView.getResource()
contained in this storage view is blank, orfalse
otherwise.protected void
Deprecated.Implement if you want.protected void
Deprecated.Called after an outer transaction succeeded, to perform irreversible actions such asmarkDirty()
or neighbor updates.protected void
readSnapshot(ResourceAmount<FluidVariant> snapshot)
Deprecated.Roll back to a state previously created bySnapshotParticipant.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
-
Field Details
-
fluidVariant
Deprecated. -
amount
public long amountDeprecated.
-
-
Constructor Details
-
SingleFluidStorage
public SingleFluidStorage()Deprecated.
-
-
Method Details
-
markDirty
protected void markDirty()Deprecated.Implement if you want. -
canInsert
Deprecated.- Returns:
true
if the passed non-blank fluid variant can be inserted,false
otherwise.
-
canExtract
Deprecated.- Returns:
true
if the passed non-blank fluid variant can be extracted,false
otherwise.
-
getCapacity
Deprecated.- 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.Description copied from interface:StorageView
Returntrue
if theStorageView.getResource()
contained in this storage view is blank, orfalse
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 interfaceStorageView<FluidVariant>
-
getResource
Deprecated.- Specified by:
getResource
in interfaceStorageView<FluidVariant>
- Returns:
- The resource stored in this view. May not be blank if
StorageView.isResourceBlank()
isfalse
.
-
getAmount
public final long getAmount()Deprecated.- Specified by:
getAmount
in interfaceStorageView<FluidVariant>
- Returns:
- The amount of
StorageView.getResource()
stored in this view.
-
getCapacity
public final long getCapacity()Deprecated.- Specified by:
getCapacity
in interfaceStorageView<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.Description copied from interface:Storage
Try to insert up to some amount of a resource into this storage.- Specified by:
insert
in interfaceStorage<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.Description copied from interface:Storage
Try to extract up to some amount of a resource from this storage.- Specified by:
extract
in interfaceStorage<FluidVariant>
- Specified by:
extract
in interfaceStorageView<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
Deprecated.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 classSnapshotParticipant<ResourceAmount<FluidVariant>>
-
readSnapshot
Deprecated.Description copied from class:SnapshotParticipant
Roll back to a state previously created bySnapshotParticipant.createSnapshot()
.- Specified by:
readSnapshot
in classSnapshotParticipant<ResourceAmount<FluidVariant>>
-
onFinalCommit
protected final void onFinalCommit()Deprecated.Description copied from class:SnapshotParticipant
Called after an outer transaction succeeded, to perform irreversible actions such asmarkDirty()
or neighbor updates.- Overrides:
onFinalCommit
in classSnapshotParticipant<ResourceAmount<FluidVariant>>
-
SingleVariantStorage
. Will be removed in a future iteration of the API.