Package net.minecraftforge.fluids

Examples of net.minecraftforge.fluids.FluidTank


    GL11.glPopMatrix();

  }

  protected void renderFluid(TileKillerJoe gen) {
    FluidTank tank = gen.fuelTank;
    if(tank.getFluidAmount() <= 0) {
      return;
    }
    IIcon icon = tank.getFluid().getFluid().getStillIcon();
    if(icon != null) {
      RenderUtil.bindBlockTexture();
      Tessellator tes = Tessellator.instance;
      tes.startDrawingQuads();

      float fullness = (float) (tank.getFluidAmount()) / (tank.getCapacity());
      BoundingBox bb = BoundingBox.UNIT_CUBE.scale(0.85, 0.96, 0.85);
      bb = bb.scale(1, 0.85 * fullness, 1);
      float ty = -(0.85f - (bb.maxY - bb.minY)) / 2;

      Vector3d offset = ForgeDirectionOffsets.offsetScaled(ForgeDirection.values()[gen.facing], -0.075);
View Full Code Here


    renderFluid(gen);
    GL11.glPopMatrix();
  }

  protected void renderFluid(TileZombieGenerator gen) {
    FluidTank tank = gen.fuelTank;
    if(tank.getFluidAmount() <= 0) {
      return;
    }
    IIcon icon = tank.getFluid().getFluid().getStillIcon();
    if(icon != null) {
      RenderUtil.bindBlockTexture();
      Tessellator tes = Tessellator.instance;
      tes.startDrawingQuads();

      float fullness = (float) (tank.getFluidAmount()) / (tank.getCapacity());
      BoundingBox bb = BoundingBox.UNIT_CUBE.scale(0.85, 0.96, 0.85);
      bb = bb.scale(1, 0.85 * fullness, 1);
      float ty = -(0.85f - (bb.maxY - bb.minY)) / 2;     
     
     
View Full Code Here

   
    tanks = new FluidTank[getNumTanks()];
    tankExposureCache = new FluidTank[getNumTanks()][1];

    for(int i = 0; i < getNumTanks(); i++) {
      tanks[i] = new FluidTank(getTankSize(i));
      tankExposureCache[i][0] = tanks[i];
    }
  }
View Full Code Here

   
    ticksSinceLastUpdate = 0;
   
    tanks = new FluidTank[NUM_TANKS];
    for(int i = 0; i < NUM_TANKS; i++)
      tanks[i] = new FluidTank(TANK_SIZE);
   
    attachedControllers = new HashSet<IMultiblockPart>();
    attachedRotorBearings = new HashSet<TileEntityTurbineRotorBearing>();
    attachedPowerTaps = new HashSet<TileEntityTurbinePowerTap>();
    attachedTickables = new HashSet<ITickableMultiblockPart>();
View Full Code Here

    public static FluidTank readFluidTank(ByteBuf buffer) throws IOException
    {
        int capacity = buffer.readInt();
        int fluidID = buffer.readInt();
        FluidTank fluidTank = new FluidTank(capacity);
        int amount = buffer.readInt();

        if (fluidID == -1)
        {
            fluidTank.setFluid(null);
        }
        else
        {
            Fluid fluid = FluidRegistry.getFluid(fluidID);
            fluidTank.setFluid(new FluidStack(fluid, amount));
        }

        return fluidTank;
    }
View Full Code Here

      List<Pair<TileEntity,ForgeDirection>> list = getAdjacentTanks(true);
      for(Pair<TileEntity,ForgeDirection> pair:list) {
        if(pair.getValue1() instanceof LogisticsTileGenericPipe) {
          if(((LogisticsTileGenericPipe)pair.getValue1()).pipe instanceof CoreRoutedPipe) continue;
        }
        FluidTank tank = ((PipeFluidTransportLogistics)this.transport).sideTanks[pair.getValue2().ordinal()];
        validDirections++;
        if(tank.getFluid() == null) continue;
        int filled = ((IFluidHandler)pair.getValue1()).fill(pair.getValue2().getOpposite(), tank.getFluid().copy(), true);
        if(filled == 0) continue;
        FluidStack drain = tank.drain(filled, true);
        if(drain == null || filled != drain.amount) {
          if(LPConstants.DEBUG) {
            throw new UnsupportedOperationException("Fluid Multiplication");
          }
        }
      }
      if(validDirections == 0) return;
      FluidTank tank = ((PipeFluidTransportLogistics)this.transport).internalTank;
      FluidStack stack = tank.getFluid();
      if(stack == null) return;
      for(Pair<TileEntity,ForgeDirection> pair:list) {
        if(pair.getValue1() instanceof LogisticsTileGenericPipe) {
          if(((LogisticsTileGenericPipe)pair.getValue1()).pipe instanceof CoreRoutedPipe) continue;
        }
        FluidTank tankSide = ((PipeFluidTransportLogistics)this.transport).sideTanks[pair.getValue2().ordinal()];
        stack = tank.getFluid();
        if(stack == null) continue;
        stack = stack.copy();
        int filled = tankSide.fill(stack , true);
        if(filled == 0) continue;
        FluidStack drain = tank.drain(filled, true);
        if(drain == null || filled != drain.amount) {
          if(LPConstants.DEBUG) {
            throw new UnsupportedOperationException("Fluid Multiplication");
View Full Code Here

    if(filterInv.getStackInSlot(0) == null) return 0;
    if(!ident.equals(FluidIdentifier.get(filterInv.getIDStackInSlot(0).getItem()))) return 0;
    int onTheWay = this.countOnRoute(ident);
    int freeSpace = -onTheWay;
    for(Pair<TileEntity,ForgeDirection> pair:getAdjacentTanks(true)) {
      FluidTank tank = ((PipeFluidTransportLogistics)this.transport).sideTanks[pair.getValue2().ordinal()];
      freeSpace += ident.getFreeSpaceInsideTank((IFluidHandler)pair.getValue1(), pair.getValue2().getOpposite());
      freeSpace += ident.getFreeSpaceInsideTank(tank);
      if(freeSpace >= stack.amount) {
        return stack.amount;
      }
View Full Code Here

 
  public FluidStack[] renderCache = new FluidStack[7];
 
  public PipeFluidTransportLogistics() {
    for(ForgeDirection dir:ForgeDirection.VALID_DIRECTIONS) {
      sideTanks[dir.ordinal()] = new FluidTank(getSideCapacity());
    }
  }
View Full Code Here

        }
      }
     
      //What does our sided internal tank have
      if(tile.orientation.ordinal() < ((PipeFluidTransportLogistics)this.transport).sideTanks.length) {
        FluidTank centerTank = ((PipeFluidTransportLogistics)this.transport).sideTanks[tile.orientation.ordinal()];
        if (centerTank != null && centerTank.getFluid() != null && wantFluids.containsKey(FluidIdentifier.get(centerTank.getFluid()))) {
          Integer liquidWant = haveFluids.get(FluidIdentifier.get(centerTank.getFluid()));
          if (liquidWant==null){
            haveFluids.put(FluidIdentifier.get(centerTank.getFluid()), centerTank.getFluid().amount);
          } else {
            haveFluids.put(FluidIdentifier.get(centerTank.getFluid()), liquidWant +  centerTank.getFluid().amount);
          }
        }
      }
     
      //What does our center internal tank have
      FluidTank centerTank = ((PipeFluidTransportLogistics)this.transport).internalTank;
      if (centerTank != null && centerTank.getFluid() != null && wantFluids.containsKey(FluidIdentifier.get(centerTank.getFluid()))) {
        Integer liquidWant = haveFluids.get(FluidIdentifier.get(centerTank.getFluid()));
        if (liquidWant==null){
          haveFluids.put(FluidIdentifier.get(centerTank.getFluid()), centerTank.getFluid().amount);
        } else {
          haveFluids.put(FluidIdentifier.get(centerTank.getFluid()), liquidWant +  centerTank.getFluid().amount);
        }
      }
     
      //HashMap<Integer, Integer> needFluids = new HashMap<Integer, Integer>();
      //Reduce what I have and what have been requested already
View Full Code Here

    return drain(from, resource.amount, doDrain);
  }

  @Override
  public FluidTankInfo[] getTankInfo(ForgeDirection direction) {
    FluidTank compositeTank = new FluidTank(tank.getCapacity());

    TileTank tile = getBottomTank();

    int capacity = tank.getCapacity();

    if (tile != null && tile.tank.getFluid() != null) {
      compositeTank.setFluid(tile.tank.getFluid().copy());
    } else {
      return new FluidTankInfo[]{compositeTank.getInfo()};
    }

    tile = getTankAbove(tile);

    while (tile != null) {

      FluidStack liquid = tile.tank.getFluid();
      if (liquid == null || liquid.amount == 0) {
        // NOOP
      } else if (!compositeTank.getFluid().isFluidEqual(liquid)) {
        break;
      } else {
        compositeTank.getFluid().amount += liquid.amount;
      }

      capacity += tile.tank.getCapacity();
      tile = getTankAbove(tile);
    }

    compositeTank.setCapacity(capacity);
    return new FluidTankInfo[]{compositeTank.getInfo()};
  }
View Full Code Here

TOP

Related Classes of net.minecraftforge.fluids.FluidTank

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.