Package buildcraft.core.inventory.filters

Examples of buildcraft.core.inventory.filters.ArrayStackFilter


      if (tmp == null) {
        continue;
      }

      int qty = 0;
      ArrayStackFilter filter;

      if (tmp instanceof ItemStack) {
        ItemStack stack = (ItemStack) tmp;
        qty = stack.stackSize;
        filter = new ArrayStackFilter(stack);
      } else {
        ArrayList<ItemStack> stacks = (ArrayList<ItemStack>) tmp;
        qty = stacks.get(0).stackSize;
        filter = new ArrayStackFilter(stacks.toArray(new ItemStack[stacks.size()]));
      }

      for (IInvSlot s : InventoryIterator.getIterable(inv)) {
        if (filter.matches(s.getStackInSlot())) {
          ItemStack removed = s.decreaseStackInSlot(qty);

          qty = qty - removed.stackSize;

          if (invCraft.getStackInSlot(i) != null) {
View Full Code Here


            filteredFilter.add(tentative);
          }
        }

        if (filteredFilter.size() > 0) {
          ArrayStackFilter arrayFilter = new ArrayStackOrListFilter(
              filteredFilter.toArray(new ItemStack[filteredFilter.size()]));

          startDelegateAI(new AIRobotFetchAndEquipItemStack(robot, arrayFilter));
        } else {
          startDelegateAI(new AIRobotGotoSleep(robot));
View Full Code Here

        craftStarted = true;
      } else {
        waitedTime++;

        if (InvUtils.getItem(robot, new ArrayStackFilter(expectedResult.crafted)) != null) {
          crafted = true;
          terminate();
        } else if (waitedTime > 120 * 60) {
          terminate();
        }
View Full Code Here

      if (tmp == null) {
        continue;
      }

      int qty = 0;
      ArrayStackFilter filter;

      if (tmp instanceof ItemStack) {
        ItemStack stack = (ItemStack) tmp;
        qty = stack.stackSize;
        filter = new ArrayStackFilter(stack);
      } else {
        ArrayList<ItemStack> stacks = (ArrayList<ItemStack>) tmp;
        qty = stacks.get(0).stackSize;
        filter = new ArrayStackFilter(stacks.toArray(new ItemStack[stacks.size()]));
      }

      for (IInvSlot s : InventoryIterator.getIterable(inv)) {
        if (filter.matches(s.getStackInSlot())) {
          ItemStack removed = s.decreaseStackInSlot(qty);

          qty = qty - removed.stackSize;

          if (removed.stackSize == 0) {
View Full Code Here

  private class StationAssemblyTableFilter implements IStationFilter {

    @Override
    public boolean matches(DockingStation station) {
      if (!ActionRobotFilter.canInteractWithItem(station, new ArrayStackFilter(expectedResult.crafted),
          ActionStationAllowCraft.class)) {
        return false;
      }

      for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
View Full Code Here

      // found that can't be built, go to sleep.
    }

    if (requirementsToLookFor != null && requirementsToLookFor.size() > 0) {
      startDelegateAI(new AIRobotGotoStationToLoad(robot,
          new ArrayStackFilter(requirementsToLookFor.getFirst()),
          robot.getZoneToWork()));
    }

    if (currentBuildingSlot != null && requirementsToLookFor != null && requirementsToLookFor.size() == 0) {
      if (currentBuildingSlot.stackConsumed == null) {
View Full Code Here

  @Override
  public void delegateAIEnded(AIRobot ai) {
    if (ai instanceof AIRobotGotoStationToLoad) {
      if (ai.success()) {
        startDelegateAI(new AIRobotLoad(robot, new ArrayStackFilter(requirementsToLookFor.getFirst()),
            requirementsToLookFor.getFirst().stackSize));
      } else {
        startDelegateAI(new AIRobotGotoSleep(robot));
      }
    } else if (ai instanceof AIRobotLoad) {
View Full Code Here

          startDelegateAI(new AIRobotGotoStationAndLoad(robot, new FuelFilter(), robot.getZoneToWork()));

          return;
        }

        if (InvUtils.getItem(robot, new ArrayStackFilter(input)) == null) {
          startDelegateAI(new AIRobotGotoStationAndLoad(robot, new ArrayStackFilter(input),
              robot.getZoneToWork()));

          return;
        }

        if (robot.getDockingStation() != stationFound) {
          startDelegateAI(new AIRobotGotoStation(robot, stationFound));

          return;
        }

        if (furnace.getStackInSlot(FUEL_SLOT) == null) {
          IInvSlot s = InvUtils.getItem(robot, new FuelFilter());
          furnace.setInventorySlotContents(FUEL_SLOT, s.decreaseStackInSlot(1));
        }

        if (furnace.getStackInSlot(INPUT_SLOT) == null) {
          IInvSlot s = InvUtils.getItem(robot, new ArrayStackFilter(input));
          furnace.setInventorySlotContents(INPUT_SLOT, s.decreaseStackInSlot(1));
        }

        craftStarted = true;
View Full Code Here

  private class StationFurnaceFilter implements IStationFilter {

    @Override
    public boolean matches(DockingStation station) {
      if (!ActionRobotFilter.canInteractWithItem(station, new ArrayStackFilter(expectedOutput),
          ActionStationAllowCraft.class)) {
        return false;
      }

      for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
View Full Code Here

    result.recipe = this;
    result.energyCost = energyCost;
    result.craftingTime = craftingTime;

    for (ItemStack requirement : inputItems) {
      IStackFilter filter = new ArrayStackFilter(requirement);
      int amount = requirement.stackSize;

      if (consumeItems(crafter, result, filter, amount, preview) != 0) {
        return null;
      }
    }

    // Item stacks with alternatives consumption

    for (List<ItemStack> requirements : inputItemsWithAlternatives) {
      IStackFilter filter = new ArrayStackFilter(requirements.toArray(new ItemStack[0]));
      int amount = requirements.get(0).stackSize;

      if (consumeItems(crafter, result, filter, amount, preview) != 0) {
        return null;
      }
View Full Code Here

TOP

Related Classes of buildcraft.core.inventory.filters.ArrayStackFilter

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.