Package net.minecraftforge.fluids

Examples of net.minecraftforge.fluids.FluidStack


      {
        long drainedAmount = 0;

        for (long i = 0; i < request.getStackSize() / 25; i++)
        {
          FluidStack drainedStack = tank.drain(facing, 25, true);
          if (drainedStack != null && drainedStack.amount != 0)
            drainedAmount += drainedStack.amount;
        }
        int remainder = (int) (request.getStackSize() - ((request.getStackSize() / 25) * 25));
        if (remainder > 0)
        {
          FluidStack drainedStack = tank.drain(facing, remainder, true);
          if (drainedStack != null && drainedStack.amount != 0)
            drainedAmount += drainedStack.amount;
        }

        ((TileEntity) tank).onInventoryChanged();
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), false);
          }
          int remainder = (int) (input.getStackSize() - ((input.getStackSize() / 25) * 25));
          if (remainder > 0)
          {
            filled += tank.fill(facing, new FluidStack(input.getItemDamage(), remainder), false);
          }

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

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

    GL11.glScalef(1.0F, -1F, 1.0F);
    model.render(0.0625f);

    if (item != null && item.hasTagCompound())
    {
      FluidStack storedFluid = FluidStack.loadFluidStackFromNBT(item.getTagCompound().getCompoundTag("tileEntity"));
      int tankCapacity = 32000;

      if (storedFluid != null && storedFluid.getFluid() != null)
      {
        Icon fluidIcon = storedFluid.getFluid().getIcon();

        Tessellator tessellator = Tessellator.instance;
        RenderBlocks renderer = new RenderBlocks();

        GL11.glScalef(1.0F, 1.0F, -1.0F);
View Full Code Here

    {
      if (itemstack.hasTagCompound())
      {
        try
        {
          FluidStack fluidInTank = FluidStack.loadFluidStackFromNBT(itemstack.getTagCompound().getCompoundTag("tileEntity"));

          if (fluidInTank != null && fluidInTank.getFluid() != null)
          {
            return StatCollector.translateToLocal(this.getUnlocalizedName(itemstack) + ".name") + " - " + fluidInTank.getFluid().getLocalizedName();
          }
        } catch (Throwable e)
        {
        }
      }
View Full Code Here

          }
          if (!monitorTE.isLocked())
          {
            if (currItem.getItem() instanceof IFluidContainerItem)
            {
              FluidStack fluid = ((IFluidContainerItem) currItem.getItem()).getFluid(currItem);
              monitorTE.setFluid(fluid != null ? fluid.getFluid() : null);
            } else if (FluidContainerRegistry.isFilledContainer(currItem))
            {
              FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(currItem);
              monitorTE.setFluid(fluid != null ? fluid.getFluid() : null);
            } else if (FluidContainerRegistry.isEmptyContainer(currItem))
            {
              monitorTE.setFluid(null);
            }
          } else
View Full Code Here

        {
          if (itemstack != null)
          {
            if (FluidContainerRegistry.isFilledContainer(itemstack))
            {
              FluidStack inContainer = FluidContainerRegistry.getFluidForFilledItem(itemstack);
              if (inContainer != null)
                itemstack = new ItemStack(ItemEnum.FLUIDDISPLAY.getItemInstance(), 1, inContainer.fluidID);
            } else if (itemstack.getItem() instanceof ItemFluidContainer)
            {
              FluidStack inContainer = ((ItemFluidContainer) itemstack.getItem()).getFluid(itemstack);
              if (inContainer != null)
                itemstack = new ItemStack(ItemEnum.FLUIDDISPLAY.getItemInstance(), 1, inContainer.fluidID);
            } else
            {
              itemstack = null;
View Full Code Here

  public ItemStack toFluidStack(ItemStack source)
  {
    if (FluidContainerRegistry.isFilledContainer(source))
    {
      FluidStack inContainer = FluidContainerRegistry.getFluidForFilledItem(source);
      if (inContainer != null)
        return new ItemStack(ItemEnum.FLUIDDISPLAY.getItemInstance(), 1, inContainer.fluidID);
    } else if (source.getItem() instanceof ItemFluidContainer)
    {
      FluidStack inContainer = ((ItemFluidContainer) source.getItem()).getFluid(source);
      if (inContainer != null)
        return new ItemStack(ItemEnum.FLUIDDISPLAY.getItemInstance(), 1, inContainer.fluidID);
    }
    return null;
  }
View Full Code Here

    return item;
  }

  public ItemStack makeLPItem(IAEItemStack stack)
  {
    return makeLPItem(new FluidStack(stack.getItemDamage(), (int) stack.getStackSize()));
  }
View Full Code Here

      worldObj.destroyBlock(x, y, z, false);
      return true;
    }
    if (current != null)
    {
      FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(current);
      TileEntityCertusTank tank = (TileEntityCertusTank) worldObj.getBlockTileEntity(x, y, z);

      if (liquid != null)
      {
        int amountFilled = tank.fill(ForgeDirection.UNKNOWN, liquid, true);

        if (amountFilled != 0 && !entityplayer.capabilities.isCreativeMode)
        {
          if (current.stackSize > 1)
          {
            entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem].stackSize -= 1;
            entityplayer.inventory.addItemStackToInventory(current.getItem().getContainerItemStack(current));
          } else
          {
            entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = current.getItem().getContainerItemStack(current);
          }
        }

        return true;

        // Handle empty containers
      } else
      {

        FluidStack available = tank.getTankInfo(ForgeDirection.UNKNOWN)[0].fluid;
        if (available != null)
        {
          ItemStack filled = FluidContainerRegistry.fillFluidContainer(available, current);

          liquid = FluidContainerRegistry.getFluidForFilledItem(filled);

          if (liquid != null)
          {
            if (!entityplayer.capabilities.isCreativeMode)
            {
              if (current.stackSize > 1)
              {
                if (!entityplayer.inventory.addItemStackToInventory(filled))
                {
                  tank.fill(ForgeDirection.UNKNOWN, new FluidStack(liquid, liquid.amount), true);
                  return false;
                } else
                {
                  entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem].stackSize -= 1;
                }
View Full Code Here

    {
      TileEntityTerminalFluid tile = (TileEntityTerminalFluid) world.getBlockTileEntity(x, y, z);
      switch (type)
      {
      case 0:
        tile.requestFluid(new FluidStack(fluidID, amount));
        break;
      case 1:
        tile.setCurrentFluid(fluidID);
        break;
      default:
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.