public int getBuildingCount(int blockId) {
   int widthOfHome = HomeManager.getHomeSize(level);
   int totalCount = 0;
   for (int x = xCoord - widthOfHome; x <= xCoord + widthOfHome; x++) {
     for (int y = yCoord - widthOfHome; y <= yCoord + widthOfHome; y++) {
       for (int z = zCoord - widthOfHome; z <= zCoord + widthOfHome; z++) {
         if (worldObj.getBlockId(x, y, z) == blockId) totalCount++;
       }
     }
   }
   return totalCount;
 }
 // This should only be called from the TE of the HomeBlock
 public List<TileEntityScourgeResource> getAllScourgeResourceBuildings() {
   List<TileEntityScourgeResource> toReturn = Lists.newArrayList();
   int widthOfHome = HomeManager.getHomeSize(level);
   for (int x = xCoord - widthOfHome; x <= xCoord + widthOfHome; x++) {
     for (int y = yCoord - widthOfHome; y <= yCoord + widthOfHome; y++) {
       for (int z = zCoord - widthOfHome; z <= zCoord + widthOfHome; z++) {
         TileEntity te = worldObj.getBlockTileEntity(x, y, z);
         if (te instanceof TileEntityScourgeResource) toReturn.add((TileEntityScourgeResource) te);
       }
     }
   }
   return toReturn;
 }
 // This should only be called from the TE of the HomeBlock
 public List<TileEntityScourgeBuilding> getBuildingsByBlock(int blockId) {
   List<TileEntityScourgeBuilding> toReturn = Lists.newArrayList();
   int widthOfHome = HomeManager.getHomeSize(level);
   for (int x = xCoord - widthOfHome; x <= xCoord + widthOfHome; x++) {
     for (int y = yCoord - widthOfHome; y <= yCoord + widthOfHome; y++) {
       for (int z = zCoord - widthOfHome; z <= zCoord + widthOfHome; z++) {
         if (worldObj.getBlockId(x, y, z) == blockId)
           toReturn.add((TileEntityScourgeBuilding) worldObj.getBlockTileEntity(x, y, z));
       }
     }
   }
   return toReturn;
 }
 public int getTotalResourceCount(int blockId) {
   int widthOfHome = HomeManager.getHomeSize(level);
   int totalCount = 0;
   for (int x = xCoord - widthOfHome; x <= xCoord + widthOfHome; x++) {
     for (int y = yCoord - widthOfHome; y <= yCoord + widthOfHome; y++) {
       for (int z = zCoord - widthOfHome; z <= zCoord + widthOfHome; z++) {
         if (worldObj.getBlockId(x, y, z) == blockId) {
           TileEntity te = worldObj.getBlockTileEntity(x, y, z);
           if (te instanceof TileEntityScourgeResource) {
             TileEntityScourgeResource teResource = (TileEntityScourgeResource) te;
             totalCount += teResource.getGold();
           }
         }
       }
     }
   }
   return totalCount;
 }
  public void build() {
    if (!sentBuildCommands) {
      int widthOfHome = HomeManager.getHomeSize(1);
      sentBuildCommands = true;
      for (int x = this.xCoord - widthOfHome; x <= xCoord + widthOfHome; x++) {
        for (int z = zCoord - widthOfHome; z <= zCoord + widthOfHome; z++) {
          addBuildingTask(new BuildingTask(x, yCoord - 2, z, Block.bedrock.blockID));
          if (x == xCoord - widthOfHome)
            addBuildingTask(new BuildingTask(x, yCoord - 1, z, Block.stone.blockID));
          if (x == xCoord + widthOfHome)
            addBuildingTask(new BuildingTask(x, yCoord - 1, z, Block.stone.blockID));
        }
        addBuildingTask(new BuildingTask(x, yCoord - 1, zCoord + widthOfHome, Block.stone.blockID));
        addBuildingTask(new BuildingTask(x, yCoord - 1, zCoord - widthOfHome, Block.stone.blockID));
      }

      super
          .build(); // Always call Super.Build at end  This way if its alrdy completed, we clear the
                    // list. Avoiding server load.
    }
  }