Package hiiragi283.lib.transfer
Class HTBasicResourceSlot
-
- All Implemented Interfaces:
-
hiiragi283.lib.transfer.HTResourceSlot,hiiragi283.lib.transfer.HTResourceView,net.neoforged.neoforge.common.util.ValueIOSerializable
public abstract class HTBasicResourceSlot<RESOURCE extends Resource> extends SnapshotJournal<Option<HTResourceStack<RESOURCE>>> implements HTResourceSlot<RESOURCE>
-
-
Field Summary
Fields Modifier and Type Field Description private final RESOURCEresourceprivate final LongamountAsLongprivate final IntegeramountAsInt
-
Constructor Summary
Constructors Constructor Description HTBasicResourceSlot(Long capacity, BiPredicate<RESOURCE, HTHandlerAccess> canInsert, BiPredicate<RESOURCE, HTHandlerAccess> canExtract, Predicate<RESOURCE> filter, Runnable listener, RESOURCE emptyResource)
-
Method Summary
Modifier and Type Method Description final RESOURCEgetResource()final LonggetAmountAsLong()IntegergetAmountAsInt()final UnitsetContents(RESOURCE resource, Long amount, TransactionContext transaction)final UnitsetContents(HTResourceStack<RESOURCE> stack, TransactionContext transaction)final BooleanisValidForInsertion(RESOURCE resource, HTHandlerAccess access)final BooleancanResourceExtract(RESOURCE resource, HTHandlerAccess access)final BooleanisValid(RESOURCE resource)Integerinsert(RESOURCE resource, Integer amount, TransactionContext transaction, HTHandlerAccess access)Integerextract(RESOURCE resource, Integer amount, TransactionContext transaction, HTHandlerAccess access)LonggetCapacityAsLong(RESOURCE resource)-
Methods inherited from class net.neoforged.neoforge.transfer.transaction.SnapshotJournal
updateSnapshots -
Methods inherited from class hiiragi283.lib.transfer.HTResourceView
getCapacityAsInt, getCurrentCapacityAsInt, getCurrentCapacityAsLong, getFilledLevel, getNeededAsInt, getNeededAsLong, isEmpty -
Methods inherited from class net.neoforged.neoforge.common.util.ValueIOSerializable
deserialize, serialize -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
HTBasicResourceSlot
HTBasicResourceSlot(Long capacity, BiPredicate<RESOURCE, HTHandlerAccess> canInsert, BiPredicate<RESOURCE, HTHandlerAccess> canExtract, Predicate<RESOURCE> filter, Runnable listener, RESOURCE emptyResource)
-
-
Method Detail
-
getResource
final RESOURCE getResource()
-
getAmountAsLong
final Long getAmountAsLong()
-
getAmountAsInt
Integer getAmountAsInt()
-
setContents
final Unit setContents(RESOURCE resource, Long amount, TransactionContext transaction)
-
setContents
final Unit setContents(HTResourceStack<RESOURCE> stack, TransactionContext transaction)
-
isValidForInsertion
final Boolean isValidForInsertion(RESOURCE resource, HTHandlerAccess access)
-
canResourceExtract
final Boolean canResourceExtract(RESOURCE resource, HTHandlerAccess access)
-
insert
Integer insert(RESOURCE resource, Integer amount, TransactionContext transaction, HTHandlerAccess access)
-
extract
Integer extract(RESOURCE resource, Integer amount, TransactionContext transaction, HTHandlerAccess access)
-
getCapacityAsLong
Long getCapacityAsLong(RESOURCE resource)
-
-
-
-