Package net.minecraftforge.fluids

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


      for (FluidTankInfo info : infos) {
        if(info.fluid != null && info.fluid.amount > 0 && from.canDrain(fromDir, info.fluid.getFluid())) {
          FluidStack maxDrain = new FluidStack(info.fluid.getFluid(), maxVolume);
          FluidStack canDrain = from.drain(fromDir, maxDrain, false);
          if(canDrain != null && canDrain.amount > 0) {
            int filled = target.fill(fromDir.getOpposite(), canDrain, true);
            from.drain(fromDir, new FluidStack(info.fluid.getFluid(), filled), true);
            res |= true;
          }
        }
      }
View Full Code Here


    BlockCoord loc = getLocation().getLocation(dir);
    IFluidHandler target = FluidUtil.getFluidHandler(worldObj, loc);
    if(target != null) {
      FluidStack canDrain = drain(dir, IO_MB_TICK, false);
      if(canDrain != null && canDrain.amount > 0) {
        int drained = target.fill(dir.getOpposite(), canDrain, true);
        if(drained > 0) {
          drain(dir, drained, true);
        }
      }
    }
View Full Code Here

      return false;
    }

    int fluidVolume = XpUtil.experienceToLiquid(XpUtil.getPlayerXP(player));
    FluidStack fs = new FluidStack(EnderIO.fluidXpJuice, fluidVolume);
    int takenVolume = fh.fill(dir, fs, true);
    if(takenVolume <= 0) {
      return false;
    }
    int xpToTake = XpUtil.liquidToExperiance(takenVolume);
    XpUtil.addPlayerXP(player, -xpToTake);
View Full Code Here

      IFluidHandler target = FluidUtil.getFluidHandler(worldObj, loc);
      if(target != null) {
        if(target.canFill(dir.getOpposite(), tank.getFluid().getFluid())) {
          FluidStack push = tank.getFluid().copy();
          push.amount = Math.min(push.amount, IO_MB_TICK);
          int filled = target.fill(dir.getOpposite(), push, true);
          if(filled > 0) {
            tank.drain(filled, true);
            tankDirty = true;
            return res;
          }
View Full Code Here

      IFluidHandler target = FluidUtil.getFluidHandler(worldObj, loc);
      if(target != null) {
        if(target.canFill(dir.getOpposite(), outputTank.getFluid().getFluid())) {
          FluidStack push = outputTank.getFluid().copy();
          push.amount = Math.min(push.amount, IO_MB_TICK);
          int filled = target.fill(dir.getOpposite(), push, true);
          if(filled > 0) {
            outputTank.drain(filled, true);
            tanksDirty = true;
            return res;
          }
View Full Code Here

      LiquidOutput output = outputIterator.next();
      if(output != null) {
        IFluidHandler cont = getTankContainer(output.location);
        if(cont != null) {
          FluidStack offer = tank.getFluid().copy();
          int filled = cont.fill(output.dir, offer, true);
          if(filled > 0) {
            tank.addAmount(-filled);

          }
        }
View Full Code Here

            pushed += toCon;
          }
        } else if(getExternalConnections().contains(dir)) {
          IFluidHandler con = getTankContainer(getLocation().getLocation(dir));
          if(con != null) {
            int toExt = con.fill(dir.getOpposite(), toPush, doPush);
            toPush.amount -= toExt;
            pushed += toExt;
            if(doPush) {
              network.outputedToExternal(toExt);
            }
View Full Code Here

    // Then to external connections
    for (ForgeDirection dir : con.getExternalConnections()) {
      if(con.canOutputToDir(dir)) {
        IFluidHandler extCon = con.getExternalHandler(dir);
        if(extCon != null) {
          int amount = extCon.fill(dir.getOpposite(), available.copy(), false);
          if(amount > 0) {
            totalRequested += amount;
            numRequests++;
          }
        }
View Full Code Here

      requestSource.amount = amountPerRequest;
      for (ForgeDirection dir : con.getExternalConnections()) {
        if(con.canOutputToDir(dir)) {
          IFluidHandler extCon = con.getExternalHandler(dir);
          if(extCon != null) {
            int amount = extCon.fill(dir.getOpposite(), requestSource.copy(), true);
            if(amount > 0) {
              outputedToExternal(amount);
              tank.addAmount(-amount);
            }
          }
View Full Code Here

            remaining--;
          }

          if(acceptorDirections.get(acceptor) != null && fluidToSend != null)
          {
            fluidSent += acceptor.fill(acceptorDirections.get(acceptor).getOpposite(), new FluidStack(fluidToSend.fluidID, currentSending), doTransfer);
          }
        }
      }
    }
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.