net.minecraftforge.fluids

## Class ItemFluidContainer

- java.lang.Object
- - net.minecraft.item.Item
  - - net.minecraftforge.fluids.ItemFluidContainer

- All Implemented Interfaces:
    IFluidContainerItem

      public class ItemFluidContainer
      extends Item
      implements IFluidContainerItem

  Reference implementation of `IFluidContainerItem`. Use/extend this or implement your own.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class net.minecraft.item.Item

      `Item.ToolMaterial`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `capacity`

    - ### Fields inherited from class net.minecraft.item.Item

      `bFull3D, canRepair, field_111210_e, hasSubtypes, iconString, itemIcon, itemRand, itemRegistry, maxStackSize`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ItemFluidContainer(int itemID)`
    `ItemFluidContainer(int itemID, int capacity)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `FluidStack` | `drain(ItemStack container, int maxDrain, boolean doDrain)`
    `int` | `fill(ItemStack container, FluidStack resource, boolean doFill)`
    `int` | `getCapacity(ItemStack container)`
    `FluidStack` | `getFluid(ItemStack container)`
    `ItemFluidContainer` | `setCapacity(int capacity)`

    - ### Methods inherited from class net.minecraft.item.Item

      `addInformation, canHarvestBlock, canItemEditBlocks, createEntity, doesContainerItemLeaveCraftingGrid, doesSneakBypassUse, func_150893_a, func_150897_b, getArmorModel, getArmorTexture, getAttributeModifiers, getChestGenBase, getColorFromItemStack, getContainerItem, getContainerItem, getCreativeTab, getCreativeTabs, getDamage, getDigSpeed, getDisplayDamage, getDurabilityForDisplay, getEntityLifespan, getFontRenderer, getHarvestLevel, getHasSubtypes, getIcon, getIcon, getIconFromDamage, getIconFromDamageForRenderPass, getIconIndex, getIconString, getIdFromItem, getIsRepairable, getItemAttributeModifiers, getItemById, getItemEnchantability, getItemFromBlock, getItemStackDisplayName, getItemStackLimit, getItemStackLimit, getItemUseAction, getMaxDamage, getMaxDamage, getMaxItemUseDuration, getMetadata, getMovingObjectPositionFromPlayer, getPotionEffect, getRarity, getRenderPasses, getShareTag, getSmeltingExperience, getSpriteNumber, getSubItems, getToolClasses, getUnlocalizedName, getUnlocalizedName, getUnlocalizedNameInefficiently, hasContainerItem, hasContainerItem, hasCustomEntity, hasEffect, hasEffect, hitEntity, isBookEnchantable, isDamageable, isDamaged, isFull3D, isItemTool, isMap, isPotionIngredient, isRepairable, isValidArmor, itemInteractionForEntity, onArmorTick, onBlockDestroyed, onBlockStartBreak, onCreated, onDroppedByPlayer, onEaten, onEntityItemUpdate, onEntitySwing, onItemRightClick, onItemUse, onItemUseFirst, onLeftClickEntity, onPlayerStoppedUsing, onUpdate, onUsingTick, registerIcons, registerItems, renderHelmetOverlay, requiresMultipleRenderPasses, setContainerItem, setCreativeTab, setDamage, setFull3D, setHarvestLevel, setHasSubtypes, setMaxDamage, setMaxStackSize, setNoRepair, setPotionEffect, setTextureName, setUnlocalizedName, shouldRotateAroundWhenRendering, showDurabilityBar`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### capacity

          protected int capacity

  - ### Constructor Detail

    - #### ItemFluidContainer

          public ItemFluidContainer(int itemID)

    - #### ItemFluidContainer

          public ItemFluidContainer(int itemID,
                            int capacity)

  - ### Method Detail

    - #### setCapacity

          public ItemFluidContainer setCapacity(int capacity)

    - #### getFluid

          public FluidStack getFluid(ItemStack container)

      Specified by:
        `getFluid` in interface `IFluidContainerItem`
      Parameters:
        `container` - ItemStack which is the fluid container.
      Returns:
        FluidStack representing the fluid in the container, null if the container is empty.

    - #### getCapacity

          public int getCapacity(ItemStack container)

      Specified by:
        `getCapacity` in interface `IFluidContainerItem`
      Parameters:
        `container` - ItemStack which is the fluid container.
      Returns:
        Capacity of this fluid container.

    - #### fill

          public int fill(ItemStack container,
                 FluidStack resource,
                 boolean doFill)

      Specified by:
        `fill` in interface `IFluidContainerItem`
      Parameters:
        `container` - ItemStack which is the fluid container.
        `resource` - FluidStack attempting to fill the container.
        `doFill` - If false, the fill will only be simulated.
      Returns:
        Amount of fluid that was (or would have been, if simulated) filled into the container.

    - #### drain

          public FluidStack drain(ItemStack container,
                         int maxDrain,
                         boolean doDrain)

      Specified by:
        `drain` in interface `IFluidContainerItem`
      Parameters:
        `container` - ItemStack which is the fluid container.
        `maxDrain` - Maximum amount of fluid to be removed from the container.
      Returns:
        Amount of fluid that was (or would have been, if simulated) drained from the container.