Package net.minecraftforge.fluids

Examples of net.minecraftforge.fluids.FluidStack


  public boolean isFull() {
    return getAmount() >= getCapacity();
  }

  public void setAmount(int amount) {
    FluidStack newLiquid = WATER.copy();
    newLiquid.amount = Math.min(getCapacity(), amount);
    setFluid(newLiquid);
  }
View Full Code Here


    setFluid(newLiquid);
  }

  @Override
  public FluidStack getFluid() {
    FluidStack l = super.getFluid();
    if(l == null) {
      l = WATER.copy();
      setFluid(l);
    }
    return l;
View Full Code Here

    if(item == null) {
      return super.onBlockActivated(world, x, y, z, entityPlayer, par6, par7, par8, par9);
    }

    //check for filled fluid containers and see if we can empty them into our tank
    FluidStack fluid = FluidUtil.getFluidFromItem(item);
    if(fluid != null) {
      int filled = gen.fill(ForgeDirection.UP, fluid, false);
      if(filled >= fluid.amount) {
        gen.fill(ForgeDirection.UP, fluid, true);
        if(!entityPlayer.capabilities.isCreativeMode) {
View Full Code Here

      toolTip.add(ItemUtil.getDurabilityString(itemStack));
    }
  }

  public static void addTooltipForFluid(List list, ItemStack stk) {
    FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(stk);
    if(fluidStack == null) {
      return;
    }
    addTooltipForFluid(list, fluidStack.getFluid());
  }
View Full Code Here

    for (ItemStack currentRequirement : requirements)
    {
      if (currentRequirement != null)
      {
        FluidStack fluid = null;
        if (FluidContainerRegistry.isFilledContainer(currentRequirement))
        {
          fluid = FluidContainerRegistry.getFluidForFilledItem(currentRequirement);
        } else if (currentRequirement.getItem() instanceof IFluidContainerItem)
        {
View Full Code Here

      {
        try
        {
          if (Block.blocksList[offsetID] instanceof IFluidBlock)
          {
            FluidStack simulation = ((IFluidBlock) Block.blocksList[offsetID]).drain(worldObj, xCoord + orientation.offsetX, yCoord + orientation.offsetY, zCoord + orientation.offsetZ, false);

            if (simulation != null && cellArray.calculateItemAddition(Util.createItemStack(new ItemStack(ItemEnum.FLUIDDISPLAY.getItemInstance(), simulation.amount, simulation.fluidID))) == null)
            {
              ((IFluidBlock) Block.blocksList[offsetID]).drain(worldObj, xCoord + orientation.offsetX, yCoord + orientation.offsetY, zCoord + orientation.offsetZ, true);
              cellArray.addItems(Util.createItemStack(new ItemStack(ItemEnum.FLUIDDISPLAY.getItemInstance(), simulation.amount, simulation.fluidID)));
View Full Code Here

    return fluidID;
  }

  public FluidStack getFluidStack()
  {
    return new FluidStack(fluidID, (int) amount);
  }
View Full Code Here

  @Override
  public void mouseClicked(int posX, int posY, int mouseX, int mouseY)
  {
    TileEntity tileEntity = guiTerminalFluid.tileEntity;
    PacketDispatcher.sendPacketToServer(new PacketTerminalFluid(tileEntity.worldObj, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, new FluidStack(fluid, 1000)).makePacket());
  }
View Full Code Here

    Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("extracells", "textures/gui/fluidtank.png"));
    drawTexturedModalRect(posX, posY, 0, 0, 18, 73);

    int iconHeightRemainder = (73 - 4) % 16;

    FluidStack fluid = tank.getFluid();
    if (fluid != null && fluid.amount > 0)
    {
      Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);

      Icon fluidIcon = fluid.getFluid().getStillIcon();

      if (iconHeightRemainder > 0)
      {
        drawTexturedModelRectFromIcon(posX + 1, posY + 2, fluidIcon, 16, iconHeightRemainder);
      }
View Full Code Here

          int filled = 0;

          for (long i = 0; i < input.getStackSize() / 25; i++)
          {
            filled += tank.fill(facing, new FluidStack(input.getItemDamage(), 25), true);
          }
          int remainder = (int) (input.getStackSize() - ((input.getStackSize() / 25) * 25));
          if (remainder > 0)
          {
            filled += tank.fill(facing, new FluidStack(input.getItemDamage(), remainder), true);
          }

          addedStack.setStackSize(input.getStackSize() - filled);

          ((TileEntity) tank).onInventoryChanged();
View Full Code Here

TOP

Related Classes of net.minecraftforge.fluids.FluidStack

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.