Пример #1
0
  protected StructureComponent func_35076_b(
      ComponentVillageStartPiece componentvillagestartpiece,
      List list,
      Random random,
      int i,
      int j) {
    switch (coordBaseMode) {
      case 2:
        return StructureVillagePieces.getNextStructureComponent(
            componentvillagestartpiece,
            list,
            random,
            boundingBox.maxX + 1,
            boundingBox.minY + i,
            boundingBox.minZ + j,
            3,
            getComponentType());

      case 0:
        return StructureVillagePieces.getNextStructureComponent(
            componentvillagestartpiece,
            list,
            random,
            boundingBox.maxX + 1,
            boundingBox.minY + i,
            boundingBox.minZ + j,
            3,
            getComponentType());

      case 1:
        return StructureVillagePieces.getNextStructureComponent(
            componentvillagestartpiece,
            list,
            random,
            boundingBox.minX + j,
            boundingBox.minY + i,
            boundingBox.maxZ + 1,
            0,
            getComponentType());

      case 3:
        return StructureVillagePieces.getNextStructureComponent(
            componentvillagestartpiece,
            list,
            random,
            boundingBox.minX + j,
            boundingBox.minY + i,
            boundingBox.maxZ + 1,
            0,
            getComponentType());
    }
    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;
  }