示例#1
0
 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;
 }
示例#2
0
 // 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;
 }
示例#3
0
 // 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;
 }
示例#4
0
 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;
 }
示例#5
0
  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.
    }
  }