public class FluidBucketWrapper extends java.lang.Object implements IFluidHandlerItem, ICapabilityProvider
Constructor and Description |
---|
FluidBucketWrapper(ItemStack container) |
Modifier and Type | Method and Description |
---|---|
boolean |
canFillFluidType(FluidStack fluidStack) |
FluidStack |
drain(FluidStack resource,
boolean doDrain)
Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler.
|
FluidStack |
drain(int maxDrain,
boolean doDrain)
Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler.
|
int |
fill(FluidStack resource,
boolean doFill)
Fills fluid into internal tanks, distribution is left entirely to the IFluidHandler.
|
<T> T |
getCapability(Capability<T> capability,
EnumFacing facing)
Retrieves the handler for the capability requested on the specific side.
|
ItemStack |
getContainer()
Get the container currently acted on by this fluid handler.
|
FluidStack |
getFluid() |
IFluidTankProperties[] |
getTankProperties()
Returns an array of objects which represent the internal tanks.
|
boolean |
hasCapability(Capability<?> capability,
EnumFacing facing)
Determines if this object has support for the capability in question on the specific side.
|
protected void |
setFluid(Fluid fluid)
Deprecated.
use the NBT-sensitive version
setFluid(FluidStack) |
protected void |
setFluid(FluidStack fluidStack) |
@Nonnull protected ItemStack container
public FluidBucketWrapper(@Nonnull ItemStack container)
@Nonnull public ItemStack getContainer()
IFluidHandlerItem
getContainer
in interface IFluidHandlerItem
public boolean canFillFluidType(FluidStack fluidStack)
@Nullable public FluidStack getFluid()
@Deprecated protected void setFluid(@Nullable Fluid fluid)
setFluid(FluidStack)
protected void setFluid(@Nullable FluidStack fluidStack)
public IFluidTankProperties[] getTankProperties()
IFluidHandler
getTankProperties
in interface IFluidHandler
public int fill(FluidStack resource, boolean doFill)
IFluidHandler
fill
in interface IFluidHandler
resource
- FluidStack representing the Fluid and maximum amount of fluid to be filled.doFill
- If false, fill will only be simulated.@Nullable public FluidStack drain(FluidStack resource, boolean doDrain)
IFluidHandler
drain
in interface IFluidHandler
resource
- FluidStack representing the Fluid and maximum amount of fluid to be drained.doDrain
- If false, drain will only be simulated.@Nullable public FluidStack drain(int maxDrain, boolean doDrain)
IFluidHandler
drain
in interface IFluidHandler
maxDrain
- Maximum amount of fluid to drain.doDrain
- If false, drain will only be simulated.public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing)
ICapabilityProvider
ICapabilityProvider.getCapability(Capability, EnumFacing)
.
Basically, this method functions analogously to Map.containsKey(Object)
.
Example: A Pipe getting a cover placed on one side causing it lose the Inventory attachment function for that side.
This is a light weight version of getCapability, intended for metadata uses.
hasCapability
in interface ICapabilityProvider
capability
- The capability to checkfacing
- The Side to check from:
CAN BE NULL. Null is defined to represent 'internal' or 'self'ICapabilityProvider.getCapability(Capability, EnumFacing)
must not return null.@Nullable public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing)
ICapabilityProvider
Basically, this method functions analogously to Map.get(Object)
.
getCapability
in interface ICapabilityProvider
capability
- The capability to checkfacing
- The Side to check from,
CAN BE NULL. Null is defined to represent 'internal' or 'self'ICapabilityProvider.hasCapability(Capability, EnumFacing)
would return true.