Examples of TileEntityCertusTank


Examples of extracells.tileentity.TileEntityCertusTank

      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;
                }
              } else
              {
                entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = filled;
              }
            }
            tank.drain(ForgeDirection.UNKNOWN, liquid.amount, true);
            return true;
          }
        }
      }
    }
View Full Code Here

Examples of extracells.tileentity.TileEntityCertusTank

  }

  @Override
  public TileEntity createNewTileEntity(World world)
  {
    return new TileEntityCertusTank();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.