Package net.minecraftforge.fluids

Examples of net.minecraftforge.fluids.IFluidHandler.fill()


    {
      IFluidHandler handler = (IFluidHandler)up.getTileEntity(worldObj);
     
      if(handler.canFill(ForgeDirection.DOWN, fluid.getFluid()))
      {
        return handler.fill(ForgeDirection.DOWN, fluid, doFill);
      }
    }
   
    return 0;
  }
View Full Code Here


        //Try to put liquid into all adjacent tanks.
        for (int i = 0; i < adjTanks.size(); i++) {
          Pair<TileEntity,ForgeDirection> pair = adjTanks.get(i);
          IFluidHandler tank = (IFluidHandler) pair.getValue1();
          ForgeDirection dir = pair.getValue2();
          filled = tank.fill(dir.getOpposite(), liquid.copy(), true);
          liquid.amount -= filled;
          if (liquid.amount != 0) continue;
          return true;
        }
        //Try inserting the liquid into the pipe side tank
View Full Code Here

    if (liquidId == null) return;
    ForgeDirection orientation = data.output.getOpposite();
    if(getUpgradeManager().hasSneakyUpgrade()) {
      orientation = getUpgradeManager().getSneakyOrientation();
    }
    while (data.getItemIdentifierStack().getStackSize() > 0 && container.fill(orientation, liquidId, false) == liquidId.amount && this.useEnergy(5)) {
      container.fill(orientation, liquidId.copy(), true);
      data.getItemIdentifierStack().lowerStackSize(1);
      Item item = data.getItemIdentifierStack().getItem().item;
      if (item.hasContainerItem(data.getItemIdentifierStack().makeNormalStack())) {
        Item containerItem = item.getContainerItem();
View Full Code Here

    ForgeDirection orientation = data.output.getOpposite();
    if(getUpgradeManager().hasSneakyUpgrade()) {
      orientation = getUpgradeManager().getSneakyOrientation();
    }
    while (data.getItemIdentifierStack().getStackSize() > 0 && container.fill(orientation, liquidId, false) == liquidId.amount && this.useEnergy(5)) {
      container.fill(orientation, liquidId.copy(), true);
      data.getItemIdentifierStack().lowerStackSize(1);
      Item item = data.getItemIdentifierStack().getItem().item;
      if (item.hasContainerItem(data.getItemIdentifierStack().makeNormalStack())) {
        Item containerItem = item.getContainerItem();
        transport.sendItem(new ItemStack(containerItem, 1));
View Full Code Here

    while (i.hasNext())
    {
      PartP2PLiquids l = i.next();
      IFluidHandler tank = l.getTarget();
      if ( tank != null )
        l.tmpUsed = tank.fill( l.side.getOpposite(), resource.copy(), false );
      else
        l.tmpUsed = 0;

      if ( l.tmpUsed <= 0 )
        i.remove();
View Full Code Here

      if ( insert.amount > available )
        insert.amount = available;

      IFluidHandler tank = l.getTarget();
      if ( tank != null )
        l.tmpUsed = tank.fill( l.side.getOpposite(), insert.copy(), true );
      else
        l.tmpUsed = 0;

      available -= insert.amount;
      used += insert.amount;
View Full Code Here

                return true;
              }
            }
            return false;
          }
          return container.fill(side, searchedFluid, false) > 0;
        case Full:
          if (searchedFluid == null) {
            for (FluidTankInfo c : liquids) {
              if (c.fluid == null || c.fluid.amount < c.capacity) {
                return false;
View Full Code Here

                return false;
              }
            }
            return true;
          }
          return container.fill(side, searchedFluid, false) <= 0;
      }
    }

    return false;
  }
View Full Code Here

      for (FluidTankInfo c : liquids) {
        if (c.fluid == null) {
          if (searchedFluid == null) {
            return true;
          }
          return container.fill(side, searchedFluid, false) > 0;
        }

        if (searchedFluid == null || searchedFluid.isFluidEqual(c.fluid)) {
          float percentage = (float) c.fluid.amount / (float) c.capacity;
          return percentage < type.level;
View Full Code Here

        if (nearbyTile != null && nearbyTile instanceof IFluidHandler) {
          IFluidHandler handler = (IFluidHandler) nearbyTile;

          FluidStack drainable = robot.drain(ForgeDirection.UNKNOWN, 1, false);

          int filledAmount = handler.fill(station.side, drainable, false);

          if (filledAmount > 0) {
            return true;
          }
        }
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.