Package buildcraft.core.robots

Examples of buildcraft.core.robots.ResourceIdBlock


      if (robot.getHeldItem().getItem() instanceof ItemSeeds) {
        startDelegateAI(new AIRobotSearchBlock(robot, new IBlockFilter() {
          @Override
          public boolean matches(World world, int x, int y, int z) {
            return BuildCraftAPI.isFarmlandProperty.get(world, x, y, z)
                && !robot.getRegistry().isTaken(new ResourceIdBlock(x, y, z))
                && isAirAbove(world, x, y, z);
          }
        }));
      } else {
        startDelegateAI(new AIRobotGotoRandomGroundBlock(robot, 100, new IBlockFilter() {
View Full Code Here


      }
    } else if (ai instanceof AIRobotSearchBlock) {
      AIRobotSearchBlock gotoBlock = (AIRobotSearchBlock) ai;

      if (gotoBlock.blockFound != null
          && robot.getRegistry().take(new ResourceIdBlock(gotoBlock.blockFound), robot)) {

        if (blockFound != null) {
          robot.getRegistry().release(new ResourceIdBlock(blockFound));
        }

        blockFound = gotoBlock.blockFound;
        startDelegateAI(new AIRobotGotoBlock(robot, gotoBlock.path));
      } else {
View Full Code Here

      startDelegateAI(new AIRobotSearchBlock(robot, new IBlockFilter() {

        @Override
        public boolean matches(World world, int x, int y, int z) {
          if (BuildCraftAPI.isFluidSource.get(world, x, y, z)
              && !robot.getRegistry().isTaken(new ResourceIdBlock(x, y, z))) {
            return matchesGateFilter(world, x, y, z);
          } else {
            return false;
          }
        }
View Full Code Here

      if (!ai.success()) {
        startDelegateAI(new AIRobotGotoSleep(robot));
      } else {
        blockFound = ((AIRobotSearchBlock) ai).blockFound;

        if (!robot.getRegistry().take(new ResourceIdBlock (blockFound), robot)) {
          blockFound = null;
          startDelegateAI(new AIRobotGotoSleep(robot));
        } else {
          startDelegateAI(new AIRobotGotoBlock(robot, ((AIRobotSearchBlock) ai).path));
        }
      }
    } else if (ai instanceof AIRobotGotoBlock) {
      if (!ai.success()) {
        startDelegateAI(new AIRobotGotoSleep(robot));
      } else {
        startDelegateAI(new AIRobotPumpBlock(robot, blockFound));
      }
    } else if (ai instanceof AIRobotGotoStationAndUnloadFluids) {
      robot.getRegistry().take(new ResourceIdBlock (blockFound), robot);

      if (!ai.success()) {
        startDelegateAI(new AIRobotGotoSleep(robot));
      }
    }
View Full Code Here

    } else {
      startDelegateAI(new AIRobotSearchBlock(robot, new IBlockFilter() {
        @Override
        public boolean matches(World world, int x, int y, int z) {
          return BuildCraftAPI.isDirtProperty.get(world, x, y, z)
              && !robot.getRegistry().isTaken(new ResourceIdBlock(x, y, z))
              && isAirAbove(world, x, y, z);
        }
      }));
    }
  }
View Full Code Here

    if (ai instanceof AIRobotSearchBlock) {
      AIRobotSearchBlock searchAI = (AIRobotSearchBlock) ai;

      if (searchAI.blockFound != null
          && RobotRegistry.getRegistry(robot.worldObj).take(
              new ResourceIdBlock(searchAI.blockFound), robot)) {

        if (blockFound != null) {
          robot.getRegistry().release(new ResourceIdBlock(blockFound));
        }

        blockFound = searchAI.blockFound;
        startDelegateAI(new AIRobotGotoBlock(robot, searchAI.path));
      } else {
        startDelegateAI(new AIRobotGotoSleep(robot));
      }
    } else if (ai instanceof AIRobotGotoBlock) {
      AIRobotGotoBlock gotoBlock = (AIRobotGotoBlock) ai;

      startDelegateAI(new AIRobotUseToolOnBlock(robot, blockFound));
    } else if (ai instanceof AIRobotFetchAndEquipItemStack) {
      if (robot.getHeldItem() == null) {
        startDelegateAI(new AIRobotGotoSleep(robot));
      }
    } else if (ai instanceof AIRobotUseToolOnBlock) {
      robot.getRegistry().release(new ResourceIdBlock(blockFound));
      blockFound = null;
    }
  }
View Full Code Here

  }

  @Override
  public void end() {
    if (blockFound != null) {
      robot.getRegistry().release(new ResourceIdBlock(blockFound));
    }
  }
View Full Code Here

  public final void preemt(AIRobot ai) {
    if (ai instanceof AIRobotSearchBlock) {
      BlockIndex index = ((AIRobotSearchBlock) ai).blockFound;

      if (!robot.getRegistry().isTaken(new ResourceIdBlock(index))) {
        abortDelegateAI();
      }
    }
  }
View Full Code Here

      updateFilter();

      startDelegateAI(new AIRobotSearchBlock(robot, new IBlockFilter() {
        @Override
        public boolean matches(World world, int x, int y, int z) {
          if (isExpectedBlock(world, x, y, z) && !robot.getRegistry().isTaken(new ResourceIdBlock(x, y, z))) {
            return matchesGateFilter(world, x, y, z);
          } else {
            return false;
          }
        }
View Full Code Here

  @Override
  public void delegateAIEnded(AIRobot ai) {
    if (ai instanceof AIRobotSearchBlock) {
      if (indexStored != null) {
        robot.getRegistry().release(new ResourceIdBlock(indexStored));
      }

      indexStored = ((AIRobotSearchBlock) ai).blockFound;

      if (indexStored == null) {
        startDelegateAI(new AIRobotGotoSleep(robot));
      } else {
        if (robot.getRegistry().take(new ResourceIdBlock(indexStored), robot)) {
          startDelegateAI(new AIRobotGotoBlock(robot, ((AIRobotSearchBlock) ai).path));
        }
      }
    } else if (ai instanceof AIRobotGotoBlock) {
      startDelegateAI(new AIRobotBreak(robot, indexStored));
    } else if (ai instanceof AIRobotBreak) {
      robot.getRegistry().release(new ResourceIdBlock(indexStored));
      indexStored = null;
    }
  }
View Full Code Here

TOP

Related Classes of buildcraft.core.robots.ResourceIdBlock

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.