Class BlankVariantView<T extends TransferVariant<?>>
java.lang.Object
net.fabricmc.fabric.api.transfer.v1.storage.base.BlankVariantView<T>
- All Implemented Interfaces:
- StorageView<T>
public class BlankVariantView<T extends TransferVariant<?>>
extends Object
implements StorageView<T>
A transfer variant storage view that contains a blank variant all the time (it's always empty), but may have a nonzero capacity.
 This can be used to give capacity hints even if the storage is empty.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionlongextract(T resource, long maxAmount, TransactionContext transaction) Try to extract a resource from this view.longlongbooleanReturntrueif theStorageView.getResource()contained in this storage view is blank, orfalseotherwise.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.fabricmc.fabric.api.transfer.v1.storage.StorageViewgetUnderlyingView
- 
Constructor Details- 
BlankVariantViewCreate a new instance.- Throws:
- IllegalArgumentException- If the passed- blankVariantis not blank.
 
 
- 
- 
Method Details- 
extractDescription copied from interface:StorageViewTry to extract a resource from this view.- Specified by:
- extractin interface- StorageView<T extends TransferVariant<?>>
- Returns:
- The amount that was extracted.
 
- 
isResourceBlankpublic boolean isResourceBlank()Description copied from interface:StorageViewReturntrueif theStorageView.getResource()contained in this storage view is blank, orfalseotherwise.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:
- isResourceBlankin interface- StorageView<T extends TransferVariant<?>>
 
- 
getResource- Specified by:
- getResourcein interface- StorageView<T extends TransferVariant<?>>
- Returns:
- The resource stored in this view. May not be blank if StorageView.isResourceBlank()isfalse.
 
- 
getAmountpublic long getAmount()- Specified by:
- getAmountin interface- StorageView<T extends TransferVariant<?>>
- Returns:
- The amount of StorageView.getResource()stored in this view.
 
- 
getCapacitypublic long getCapacity()- Specified by:
- getCapacityin interface- StorageView<T extends TransferVariant<?>>
- Returns:
- The total amount of StorageView.getResource()that could be stored in this view, or an estimated upper bound on the number of resources that could be stored if this view has a blank resource.
 
 
-