Package net.minecraftforge.fluids

Examples of net.minecraftforge.fluids.IFluidContainerItem


  public void renderItem(ItemRenderType type, ItemStack stack, Object... data) {

    Item item = stack.getItem();
    FluidStack fluid = null;
    if (item instanceof IFluidContainerItem) {
      IFluidContainerItem fluidItem = (IFluidContainerItem) item;
      fluid = fluidItem.getFluid(stack);
    } else if (item instanceof IFluidOverlayItem) {
      if (item.getRenderPasses(ItemHelper.getItemDamage(stack)) == 2) {
        fluid = FluidContainerRegistry.getFluidForFilledItem(stack);
      }
    }
View Full Code Here


    return extractFluid(tileTank.getCapacity()-tileTank.getFluidAmount(), container, fluid);
  }
 
  public static FluidStack extractFluid(int needed, ItemStack container, Fluid fluid)
  {
    IFluidContainerItem item = (IFluidContainerItem)container.getItem();
   
    if(item.getFluid(container) == null)
    {
      return null;
    }
   
    if(fluid != null && item.getFluid(container).getFluid() != fluid)
    {
      return null;
    }
   
    return item.drain(container, needed, true);
  }
View Full Code Here

    return insertFluid(tileTank.getFluid(), container);
  }
 
  public static int insertFluid(FluidStack fluid, ItemStack container)
  {
    IFluidContainerItem item = (IFluidContainerItem)container.getItem();
   
    if(fluid == null)
    {
      return 0;
    }
   
    return item.fill(container, fluid, true);
  }
View Full Code Here

TOP

Related Classes of net.minecraftforge.fluids.IFluidContainerItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.