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 StructureVillageStart(World par1World, Random par2Random, int par3, int par4, int par5) { hasMoreThanTwoComponents = false; ArrayList arraylist = StructureVillagePieces.getStructureVillageWeightedPieceList(par2Random, par5); ComponentVillageStartPiece componentvillagestartpiece = new ComponentVillageStartPiece( par1World.getWorldChunkManager(), 0, par2Random, (par3 << 4) + 2, (par4 << 4) + 2, arraylist, par5); components.add(componentvillagestartpiece); componentvillagestartpiece.buildComponent(componentvillagestartpiece, components, par2Random); ArrayList arraylist1 = componentvillagestartpiece.field_74930_j; for (ArrayList arraylist2 = componentvillagestartpiece.field_74932_i; !arraylist1.isEmpty() || !arraylist2.isEmpty(); ) { if (arraylist1.isEmpty()) { int i = par2Random.nextInt(arraylist2.size()); StructureComponent structurecomponent = (StructureComponent) arraylist2.remove(i); structurecomponent.buildComponent(componentvillagestartpiece, components, par2Random); } else { int j = par2Random.nextInt(arraylist1.size()); StructureComponent structurecomponent1 = (StructureComponent) arraylist1.remove(j); structurecomponent1.buildComponent(componentvillagestartpiece, components, par2Random); } } updateBoundingBox(); int k = 0; Iterator iterator = components.iterator(); do { if (!iterator.hasNext()) { break; } StructureComponent structurecomponent2 = (StructureComponent) iterator.next(); if (!(structurecomponent2 instanceof ComponentVillageRoadPiece)) { k++; } } while (true); hasMoreThanTwoComponents = k > 2; }