Class BucketResourceHandler
java.lang.Object
net.neoforged.neoforge.transfer.ItemAccessResourceHandler<FluidResource>
net.neoforged.neoforge.transfer.fluid.BucketResourceHandler
- All Implemented Interfaces:
ResourceHandler<FluidResource>
A handler for empty and filled buckets.
Swaps between empty bucket and filled bucket of the correct type.
-
Field Summary
Fields inherited from class net.neoforged.neoforge.transfer.ItemAccessResourceHandler
itemAccess, size -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intgetAmountFrom(ItemResource accessResource, int index) Retrieves the amount stored in the current contents of the item access.protected intgetCapacity(int index, FluidResource resource) Return the maximum capacity of this handler for the passed resource.protected FluidResourcegetResourceFrom(ItemResource accessResource, int index) Retrieves the resource stored in the current contents of the item access.protected ItemResourceupdate(ItemResource accessResource, int index, FluidResource newResource, int newAmount) Returns a resource with updated resource and amount.Methods inherited from class net.neoforged.neoforge.transfer.ItemAccessResourceHandler
extract, getAmountAsLong, getCapacityAsLong, getResource, insert, isValid, sizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.neoforged.neoforge.transfer.ResourceHandler
extract, getAmountAsInt, getCapacityAsInt, insert
-
Constructor Details
-
BucketResourceHandler
-
-
Method Details
-
getResourceFrom
Description copied from class:ItemAccessResourceHandlerRetrieves the resource stored in the current contents of the item access.- Specified by:
getResourceFromin classItemAccessResourceHandler<FluidResource>
-
getAmountFrom
Description copied from class:ItemAccessResourceHandlerRetrieves the amount stored in the current contents of the item access.- Specified by:
getAmountFromin classItemAccessResourceHandler<FluidResource>- See Also:
-
update
protected ItemResource update(ItemResource accessResource, int index, FluidResource newResource, int newAmount) Description copied from class:ItemAccessResourceHandlerReturns a resource with updated resource and amount.- Specified by:
updatein classItemAccessResourceHandler<FluidResource>- Parameters:
accessResource- current resource, before the updateindex- the index at which the resource and amount should be updatednewResource- the new resource, never empty: empty is indicated by a 0 amountnewAmount- the new amount- Returns:
accessResourceupdated with the new resource and amount, orItemResource.EMPTYif the new resource or amount cannot be stored
-
getCapacity
Description copied from class:ItemAccessResourceHandlerReturn the maximum capacity of this handler for the passed resource. If the passed resource is empty, an estimate should be returned.- Specified by:
getCapacityin classItemAccessResourceHandler<FluidResource>- Returns:
- The maximum capacity of this handler for the passed resource.
- See Also:
-