Package buildcraft.api.core

Examples of buildcraft.api.core.BlockIndex


    nbt.setTag("index", indexNBT);
    nbt.setByte("side", (byte) side.ordinal());
  }

  protected void readFromNBT(NBTTagCompound nbt) {
    index = new BlockIndex(nbt.getCompoundTag("index"));
    side = ForgeDirection.values()[nbt.getByte("side")];
  }
View Full Code Here


      if (!ai.success()) {
        crafted = false;
        terminate();
      } else {
        stationFound = ((AIRobotSearchStation) ai).targetStation;
        table = getUsableAssemblyTable(new BlockIndex(stationFound.x(), stationFound.y(), stationFound.z()));

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

        BlockIndex index = new BlockIndex(table);

        if (!robot.getRegistry().take(new ResourceIdBlock(index), robot)) {
          terminate();
        }
View Full Code Here

  }

  private TileAssemblyTable getUsableAssemblyTable(BlockIndex b) {

    for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
      BlockIndex index = new BlockIndex (b.x + dir.offsetX, b.y
          + dir.offsetY, b.z
          + dir.offsetZ);

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

          ActionStationAllowCraft.class)) {
        return false;
      }

      for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
        if (getUsableAssemblyTable(new BlockIndex(station.x(), station.y(), station.z())) != null) {
          return true;
        }
      }

      return false;
View Full Code Here

      if (aiFind.blockFound == null) {
        terminate();
      }

      blockFound = aiFind.blockFound;
      pathFinding = new PathFinding(robot.worldObj, new BlockIndex(robot), blockFound);
      pathFindingJob = new PathFindingJob(pathFinding);
      pathFindingJob.start();
    } else if (ai instanceof AIRobotGotoBlock) {
      terminate();
    }
View Full Code Here

  @Override
  public void loadSelfFromNBT(NBTTagCompound nbt) {
    super.loadSelfFromNBT(nbt);

    if (nbt.hasKey("blockToBreak")) {
      blockToBreak = new BlockIndex(nbt.getCompoundTag("blockToBreak"));
    }
  }
View Full Code Here

  }

  @Override
  public void update() {
    if (path == null && pathSearch == null) {
      pathSearch = new PathFinding(robot.worldObj, new BlockIndex((int) Math.floor(robot.posX),
          (int) Math.floor(robot.posY), (int) Math.floor(robot.posZ)), new BlockIndex(
          (int) Math.floor(finalX), (int) Math.floor(finalY), (int) Math.floor(finalZ)), maxDistance);

      pathSearchJob = new PathFindingJob(pathSearch, 100);
      pathSearchJob.start();
    } else if (path != null) {
View Full Code Here

    }
  }

  private void setNextInPath() {
    if (path.size() > 0) {
      BlockIndex next = path.getFirst();
      setDestination(robot, next.x + 0.5F, next.y + 0.5F, next.z + 0.5F);
      prevDistance = Double.MAX_VALUE;
    }
  }
View Full Code Here

      NBTTagList pathList = nbt.getTagList("path", Constants.NBT.TAG_COMPOUND);

      path = new LinkedList<BlockIndex>();

      for (int i = 0; i < pathList.tagCount(); ++i) {
        path.add(new BlockIndex(pathList.getCompoundTagAt(i)));
      }

      setNextInPath();
    }
  }
View Full Code Here

    }

    NBTTagList subBptList = nbt.getTagList("subBlueprints", Constants.NBT.TAG_COMPOUND);

    for (int i = 0; i < subBptList.tagCount(); ++i) {
      BlockIndex index = new BlockIndex(subBptList.getCompoundTagAt(i));

      addSubBlueprint(index);
    }
  }
View Full Code Here

TOP

Related Classes of buildcraft.api.core.BlockIndex

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.