public BlockPos func_180706_b(World world, BlockPos pos) {
    this.world = world;
    this.func_143027_a(world);
    this.rand.setSeed(world.getSeed());
    long var3 = this.rand.nextLong();
    long var5 = this.rand.nextLong();
    long var7 = (long) (pos.x >> 4) * var3;
    long var9 = (long) (pos.z >> 4) * var5;
    this.rand.setSeed(var7 ^ var9 ^ world.getSeed());
    this.func_180701_a(world, pos.x >> 4, pos.z >> 4, 0, 0, null);
    double var11 = Double.MAX_VALUE;
    BlockPos var13 = null;
    BlockPos var17;
    double var18;

    for (StructureStart var15 : this.structureMap.values()) {
      if (var15.isSizeableStructure()) {
        StructureComponent var16 = var15.getComponents().get(0);
        var17 = var16.getCenter();
        var18 = var17.squareDistanceTo(pos);

        if (var18 < var11) {
          var11 = var18;
          var13 = var17;
        }
      }
    }

    if (var13 != null) {
      return var13;
    } else {
      List<BlockPos> var20 = this.getCoordList();

      if (var20 != null) {
        BlockPos var21 = null;

        for (BlockPos p : var20) {
          var18 = p.squareDistanceTo(pos);

          if (var18 < var11) {
            var11 = var18;
            var21 = p;
          }
        }

        return var21;
      } else {
        return null;
      }
    }
  }
  public boolean func_175794_a(World world, Random rand, ChunkPos cpos) {
    this.func_143027_a(world);
    int var4 = (cpos.cx << 4) + 8;
    int var5 = (cpos.cz << 4) + 8;
    boolean var6 = false;

    for (StructureStart start : this.structureMap.values()) {
      if (start.isSizeableStructure()
          && start.func_175788_a(cpos)
          && start.getBoundingBox().intersectsWith(var4, var5, var4 + 15, var5 + 15)) {
        start.generate(world, rand, new StructureBoundingBox(var4, var5, var4 + 15, var5 + 15));
        start.func_175787_b(cpos);
        var6 = true;
        this.addStructureStart(start.getX(), start.getZ(), start);
      }
    }

    return var6;
  }
 private void addStructureStart(int x, int z, StructureStart start) {
   this.itemData.addTag(start.writeToNBT(x, z), x, z);
   this.itemData.markDirty();
 }