Package logisticspipes.utils

Examples of logisticspipes.utils.FluidIdentifier


    FluidTankInfo[] tanks = ((IFluidHandler)tile).getTankInfo(ForgeDirection.UNKNOWN);
    for(FluidTankInfo tank:tanks) {
      if(tank == null) continue;
      FluidStack liquid;
      if((liquid = tank.fluid) != null && liquid.fluidID != 0) {
        FluidIdentifier ident = FluidIdentifier.get(liquid);
        if(((IFluidHandler)tile).drain(ForgeDirection.UNKNOWN, 1, false) != null) {
          if(map.containsKey(ident)) {
            long addition = map.get(ident) + tank.fluid.amount;
            map.put(ident, addition);
          } else {
View Full Code Here


   
    if(slot instanceof FluidSlot) {
      if(currentlyEquippedStack != null) {
        FluidStack liquidId = FluidContainerRegistry.getFluidForFilledItem(currentlyEquippedStack);
        if(liquidId != null) {
          FluidIdentifier ident = FluidIdentifier.get(liquidId);
          if(mouseButton == 0) {
            if(ident == null) {
              slot.putStack(null);
            } else {
              slot.putStack(ident.getItemIdentifier().unsafeMakeNormalStack(1));
            }
          } else {
            slot.putStack(null);
          }
          return currentlyEquippedStack;
        }
      }
      FluidIdentifier ident = null;
      if(slot.getStack() != null) {
        ident = FluidIdentifier.get(ItemIdentifier.get(slot.getStack()));
      }
      if(mouseButton == 0) {
        if(ident != null) {
          ident = ident.next();
        } else {
          ident = FluidIdentifier.first();
        }
      } else if(mouseButton == 1) {
        if(ident != null) {
          ident = ident.prev();
        } else {
          ident = FluidIdentifier.last();
        }
      } else {
        ident = null;
      }
      if(ident == null) {
        slot.putStack(null);
      } else {
        slot.putStack(ident.getItemIdentifier().unsafeMakeNormalStack(1));
      }
      if(entityplayer instanceof EntityPlayerMP && MainProxy.isServer(entityplayer.worldObj)) {
        ((EntityPlayerMP)entityplayer).sendSlotContents(this, slotId, slot.getStack());
      }
      return currentlyEquippedStack;
View Full Code Here

        if(tanks != null) {
          for(FluidTankInfo tank:tanks) {
            if(tank == null) continue;
            FluidStack liquid;
            if((liquid = tank.fluid) != null && liquid.fluidID != 0) {
              FluidIdentifier ident = FluidIdentifier.get(liquid);
              if(((IFluidHandler)pair.getValue1()).canDrain(pair.getValue2().getOpposite(), liquid.getFluid())) {
                if(((IFluidHandler)pair.getValue1()).drain(pair.getValue2().getOpposite(), 1, false) != null) {
                  if(map.containsKey(ident)) {
                    long addition = ((long)map.get(ident)) + tank.fluid.amount;
                    map.put(ident, addition > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) addition);
View Full Code Here

            if(tank == null) continue;
            FluidStack liquid;
            if((liquid = tank.fluid) != null && liquid.fluidID != 0) {
              if(((IFluidHandler)pair.getValue1()).canDrain(pair.getValue2().getOpposite(), liquid.getFluid())) {
                if(((IFluidHandler)pair.getValue1()).drain(pair.getValue2().getOpposite(), 1, false) != null) {
                  FluidIdentifier ident = FluidIdentifier.get(liquid);
                  l1.add(ident.getItemIdentifier());
                }
              }
            }
          }
        }
View Full Code Here

  }

  @Override
  public int sinkAmount(FluidStack stack) {
    if(!guiOpenedBy.isEmpty()) return 0; //Don't sink when the gui is open
    FluidIdentifier ident = FluidIdentifier.get(stack);
    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;
      }
    }
     return freeSpace;
View Full Code Here

        }
      }
    }
   
    for (int i = 0; i < liquidCrafter; i++){
      FluidIdentifier liquid = getFluidMaterial(i);
      int amount = getFluidAmount()[i];
      if (liquid == null || amount <= 0 || liquidTarget[i] == null) continue;
      template.addRequirement(liquid, amount, liquidTarget[i]);
    }
   
View Full Code Here

      IFluidHandler container = (IFluidHandler) tile.tile;
      if (container.getTankInfo(ForgeDirection.UNKNOWN) == null || container.getTankInfo(ForgeDirection.UNKNOWN).length == 0) continue;
     
      //How much do I want?
      Map<FluidIdentifier, Integer> wantFluids = new HashMap<FluidIdentifier, Integer>();
      FluidIdentifier fIdent = FluidIdentifier.get(dummyInventory.getIDStackInSlot(0).getItem());
      wantFluids.put(fIdent, amount);

      //How much do I have?
      HashMap<FluidIdentifier, Integer> haveFluids = new HashMap<FluidIdentifier, Integer>();
View Full Code Here

      }
      for (Entry<ItemIdentifier, Integer> requestedItem : _requestedItems.entrySet()){
        ItemStack wantItem = requestedItem.getKey().unsafeMakeNormalStack(1);
        FluidStack requestedFluidId = FluidContainerRegistry.getFluidForFilledItem(wantItem);
        if (requestedFluidId == null) continue;
        FluidIdentifier requestedFluid = FluidIdentifier.get(requestedFluidId);
        Integer want = wantFluids.get(requestedFluid);
        if(want != null) {
          wantFluids.put(requestedFluid, want - requestedItem.getValue() * requestedFluidId.amount);
        }
      }
 
View Full Code Here

TOP

Related Classes of logisticspipes.utils.FluidIdentifier

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.