public class FluidBucketWrapper extends java.lang.Object implements IFluidHandlerItem, ICapabilityProvider
IFluidHandler.FluidAction
Modifier and Type | Field and Description |
---|---|
protected ItemStack |
container |
private LazyOptional<IFluidHandlerItem> |
holder |
Constructor and Description |
---|
FluidBucketWrapper(ItemStack container) |
Modifier and Type | Method and Description |
---|---|
boolean |
canFillFluidType(FluidStack fluid) |
FluidStack |
drain(FluidStack resource,
IFluidHandler.FluidAction action)
Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler.
|
FluidStack |
drain(int maxDrain,
IFluidHandler.FluidAction action)
Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler.
|
int |
fill(FluidStack resource,
IFluidHandler.FluidAction action)
Fills fluid into internal tanks, distribution is left entirely to the IFluidHandler.
|
<T> LazyOptional<T> |
getCapability(Capability<T> capability,
Direction facing)
Retrieves the Optional handler for the capability requested on the specific side.
|
ItemStack |
getContainer()
Get the container currently acted on by this fluid handler.
|
FluidStack |
getFluid() |
FluidStack |
getFluidInTank(int tank)
Returns the FluidStack in a given tank.
|
int |
getTankCapacity(int tank)
Retrieves the maximum fluid amount for a given tank.
|
int |
getTanks()
Returns the number of fluid storage units ("tanks") available
|
boolean |
isFluidValid(int tank,
FluidStack stack)
This function is a way to determine which fluids can exist inside a given handler.
|
protected void |
setFluid(FluidStack fluidStack) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCapability
private final LazyOptional<IFluidHandlerItem> holder
@Nonnull protected ItemStack container
public FluidBucketWrapper(@Nonnull ItemStack container)
@Nonnull public ItemStack getContainer()
IFluidHandlerItem
getContainer
in interface IFluidHandlerItem
public boolean canFillFluidType(FluidStack fluid)
@Nonnull public FluidStack getFluid()
protected void setFluid(@Nonnull FluidStack fluidStack)
public int getTanks()
IFluidHandler
getTanks
in interface IFluidHandler
@Nonnull public FluidStack getFluidInTank(int tank)
IFluidHandler
IMPORTANT: This FluidStack MUST NOT be modified. This method is not for altering internal contents. Any implementers who are able to detect modification via this method should throw an exception. It is ENTIRELY reasonable and likely that the stack returned here will be a copy.
SERIOUSLY: DO NOT MODIFY THE RETURNED FLUIDSTACK
getFluidInTank
in interface IFluidHandler
tank
- Tank to query.public int getTankCapacity(int tank)
IFluidHandler
getTankCapacity
in interface IFluidHandler
tank
- Tank to query.public boolean isFluidValid(int tank, @Nonnull FluidStack stack)
IFluidHandler
isFluidValid
in interface IFluidHandler
tank
- Tank to query for validitystack
- Stack to test with for validitypublic int fill(FluidStack resource, IFluidHandler.FluidAction action)
IFluidHandler
fill
in interface IFluidHandler
resource
- FluidStack representing the Fluid and maximum amount of fluid to be filled.action
- If SIMULATE, fill will only be simulated.@Nonnull public FluidStack drain(FluidStack resource, IFluidHandler.FluidAction action)
IFluidHandler
drain
in interface IFluidHandler
resource
- FluidStack representing the Fluid and maximum amount of fluid to be drained.action
- If SIMULATE, drain will only be simulated.@Nonnull public FluidStack drain(int maxDrain, IFluidHandler.FluidAction action)
IFluidHandler
drain
in interface IFluidHandler
maxDrain
- Maximum amount of fluid to drain.action
- If SIMULATE, drain will only be simulated.@Nonnull public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> capability, @Nullable Direction facing)
ICapabilityProvider
getCapability
in interface ICapabilityProvider