Examples of IInvSlot


Examples of buildcraft.api.core.IInvSlot

  }

  private BuildingSlotBlock internalGetNextBlock(World world, TileAbstractBuilder builder) {
    BuildingSlotBlock result = null;

    IInvSlot firstSlotToConsume = null;

    for (IInvSlot invSlot : InventoryIterator.getIterable(builder, ForgeDirection.UNKNOWN)) {
      if (!builder.isBuildingMaterialSlot(invSlot.getIndex())) {
        continue;
      }

      ItemStack stack = invSlot.getStackInSlot();

      if (stack != null && stack.stackSize > 0) {
        firstSlotToConsume = invSlot;
        break;
      }
    }

    iterator.startIteration();

    while (iterator.hasNext()) {
      BuildingSlotBlock slot = iterator.next();

      if (slot.buildStage > buildList.getFirst().buildStage) {
        iterator.reset ();
        return null;
      }

      if (BlockUtil.isUnbreakableBlock(world, slot.x, slot.y, slot.z)) {
        iterator.remove();
        if (slot.mode == Mode.ClearIfInvalid) {
          clearedLocations.add(new BlockIndex(slot.x, slot.y, slot.z));
        } else {
          builtLocations.add(new BlockIndex(slot.x, slot.y, slot.z));
        }
      } else if (slot.mode == Mode.ClearIfInvalid) {
        if (BuildCraftAPI.isSoftBlock(world, slot.x, slot.y, slot.z)) {
          iterator.remove();
          clearedLocations.add(new BlockIndex(slot.x, slot.y, slot.z));
        } else {
          if (canDestroy(builder, context, slot)) {
            consumeEnergyToDestroy(builder, slot);
            createDestroyItems(slot);

            result = slot;
            iterator.remove();
            clearedLocations.add(new BlockIndex(slot.x, slot.y, slot.z));

            break;
          }
        }
      } else if (slot.mode == Mode.Build) {
        if (!BuildCraftAPI.isSoftBlock(world, slot.x, slot.y, slot.z)) {
          iterator.remove();
          builtLocations.add(new BlockIndex(slot.x, slot.y, slot.z));
        } else {
          if (builder.consumeEnergy(BuilderAPI.BUILD_ENERGY) && firstSlotToConsume != null) {
            slot.addStackConsumed(firstSlotToConsume.decreaseStackInSlot(1));
            result = slot;
            iterator.remove();
            builtLocations.add(new BlockIndex(slot.x, slot.y, slot.z));

            break;
View Full Code Here

Examples of buildcraft.api.core.IInvSlot

    int added = 0;

    for (int itemLoop = 0; itemLoop < stack.stackSize; ++itemLoop) { // add 1 item n times.

      int smallestStackSize = Integer.MAX_VALUE;
      IInvSlot minSlot = null;

      for (IInvSlot slot : InventoryIterator.getIterable(inventory, orientation)) {
        ItemStack stackInInventory = slot.getStackInSlot();

        if (stackInInventory == null) {
View Full Code Here

Examples of buildcraft.api.core.IInvSlot

      if (!ai.success()) {
        terminate();
        return;
      }

      IInvSlot slot = InvUtils.getItem(robot, new ArrayStackOrListFilter(requested.stack));

      if (slot == null) {
        terminate();
        return;
      }

      if (requested.requester != null) {
        ItemStack newStack = ((IRequestProvider)
          requested.requester).provideItemsForRequest(requested.index,
              slot.getStackInSlot().copy());

        if (newStack == null || newStack.stackSize != slot.getStackInSlot().stackSize) {
          delivered = true;
          slot.setStackInSlot(newStack);
        }

        terminate();
      } else {
        startDelegateAI(new AIRobotUnload(robot));
View Full Code Here

Examples of buildcraft.api.core.IInvSlot

          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;

        if (!robot.hasFreeSlot()) {
View Full Code Here

Examples of forestry.core.inventory.wrappers.IInvSlot

      return;
    }

    if (analyzeTime == 0) {
      // Look for bees in input slots.
      IInvSlot slot = getInputSlot();
      if (slot == null) {
        // Nothing to analyze
        setErrorState(EnumErrorCode.NOTHINGANALYZE);
        return;
      }
View Full Code Here

Examples of forestry.core.inventory.wrappers.IInvSlot

    if (getErrorState() != EnumErrorCode.OK)
      return false;

    // Look for bees in input slots.
    IInvSlot slot = getInputSlot();
    ItemStack inputStack = slot.getStackInSlot();
    setInventorySlotContents(SLOT_ANALYZE, inputStack);
    slot.setStackInSlot(null);
    resourceTank.drain(HONEY_REQUIRED, true);
    analyzeTime = TIME_TO_ANALYZE;
    sendNetworkUpdate();
    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.