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.
  Author:
    King Lemming

- - ### Field Summary

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

      `appleGold, appleRed, arrow, axeDiamond, axeGold, axeIron, axeStone, axeWood, bakedPotato, bed, beefCooked, beefRaw, blazePowder, blazeRod, boat, bone, book, bootsChain, bootsDiamond, bootsGold, bootsIron, bootsLeather, bow, bowlEmpty, bowlSoup, bread, brewingStand, brick, bucketEmpty, bucketLava, bucketMilk, bucketWater, cake, carrot, carrotOnAStick, cauldron, chickenCooked, chickenRaw, clay, coal, comparator, compass, cookie, diamond, doorIron, doorWood, dyePowder, egg, emerald, emptyMap, enchantedBook, enderPearl, expBottle, eyeOfEnder, feather, fermentedSpiderEye, fireballCharge, firework, fireworkCharge, fishCooked, fishingRod, fishRaw, flint, flintAndSteel, flowerPot, ghastTear, glassBottle, glowstone, goldenCarrot, goldNugget, gunpowder, helmetChain, helmetDiamond, helmetGold, helmetIron, helmetLeather, hoeDiamond, hoeGold, hoeIron, hoeStone, hoeWood, horseArmorDiamond, horseArmorGold, horseArmorIron, ingotGold, ingotIron, itemFrame, itemID, itemsList, leash, leather, legsChain, legsDiamond, legsGold, legsIron, legsLeather, magmaCream, map, melon, melonSeeds, minecartCrate, minecartEmpty, minecartHopper, minecartPowered, minecartTnt, monsterPlacer, nameTag, netherQuartz, netherrackBrick, netherStalkSeeds, netherStar, painting, paper, pickaxeDiamond, pickaxeGold, pickaxeIron, pickaxeStone, pickaxeWood, plateChain, plateDiamond, plateGold, plateIron, plateLeather, pocketSundial, poisonousPotato, porkCooked, porkRaw, potato, potion, pumpkinPie, pumpkinSeeds, record11, record13, recordBlocks, recordCat, recordChirp, recordFar, recordMall, recordMellohi, recordStal, recordStrad, recordWait, recordWard, redstone, redstoneRepeater, reed, rottenFlesh, saddle, seeds, shears, shovelDiamond, shovelGold, shovelIron, shovelStone, shovelWood, sign, silk, skull, slimeBall, snowball, speckledMelon, spiderEye, stick, sugar, swordDiamond, swordGold, swordIron, swordStone, swordWood, wheat, writableBook, writtenBook`

  - ### 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, canHarvestBlock, canItemEditBlocks, createEntity, doesContainerItemLeaveCraftingGrid, getArmorModel, getArmorTexture, getArmorTexture, getChestGenBase, getColorFromItemStack, getContainerItem, getContainerItemStack, getCreativeTab, getCreativeTabs, getDamage, getDamageVsEntity, getDisplayDamage, getEntityLifespan, getFontRenderer, getHasSubtypes, getIcon, getIcon, getIconFromDamage, getIconFromDamageForRenderPass, getIconIndex, getIsRepairable, getItemAttributeModifiers, getItemDisplayName, getItemEnchantability, getItemStackDisplayName, getItemStackLimit, getItemStackLimit, getItemUseAction, getMaxDamage, getMaxDamage, getMaxItemUseDuration, getMetadata, getPotionEffect, getPotionEffect, getRarity, getRenderPasses, getShareTag, getSmeltingExperience, getSpriteNumber, getStatName, getStrVsBlock, getStrVsBlock, getSubItems, getUnlocalizedName, getUnlocalizedName, getUnlocalizedNameInefficiently, hasContainerItem, hasCustomEntity, hasEffect, hasEffect, hitEntity, isBookEnchantable, isDamageable, isDamaged, isFull3D, isItemTool, isMap, isPotionIngredient, isPotionIngredient, isRepairable, isValidArmor, itemInteractionForEntity, onArmorTickUpdate, onBlockDestroyed, onBlockStartBreak, onCreated, onDroppedByPlayer, onEaten, onEntityItemUpdate, onEntitySwing, onItemRightClick, onItemUse, onItemUseFirst, onLeftClickEntity, onPlayerStoppedUsing, onUpdate, onUsingItemTick, registerIcons, renderHelmetOverlay, requiresMultipleRenderPasses, setContainerItem, setCreativeTab, setDamage, setFull3D, setMaxDamage, setMaxStackSize, setNoRepair, setPotionEffect, setTextureName, setUnlocalizedName, shouldPassSneakingClickToBlock, shouldRotateAroundWhenRendering`

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

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

- - ### 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.