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;
  }
 /**
  * arguments: (World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int
  * maxX, int maxY, int maxZ, int placeBlockId, int replaceBlockId, boolean alwaysreplace)
  */
 protected void fillWithBlocks(
     World par1World,
     StructureBoundingBox par2StructureBoundingBox,
     int par3,
     int par4,
     int par5,
     int par6,
     int par7,
     int par8,
     int par9,
     int par10,
     boolean par11) {
   int var12 = this.func_74890_d(par9, 0);
   int var13 = this.func_74892_e(par9, 0);
   int var14 = this.func_74890_d(par10, 0);
   int var15 = this.func_74892_e(par10, 0);
   super.fillWithMetadataBlocks(
       par1World,
       par2StructureBoundingBox,
       par3,
       par4,
       par5,
       par6,
       par7,
       par8,
       var12,
       var13,
       var14,
       var15,
       par11);
 }
  public StructureNetherBridgeStart(World par1World, Random par2Random, int par3, int par4) {
    ComponentNetherBridgeStartPiece var5 =
        new ComponentNetherBridgeStartPiece(par2Random, (par3 << 4) + 2, (par4 << 4) + 2);
    this.components.add(var5);
    var5.buildComponent(var5, this.components, par2Random);
    ArrayList var6 = var5.field_40293_d;

    while (!var6.isEmpty()) {
      int var7 = par2Random.nextInt(var6.size());
      StructureComponent var8 = (StructureComponent) var6.remove(var7);
      var8.buildComponent(var5, this.components, par2Random);
    }

    this.updateBoundingBox();
    this.setRandomHeight(par1World, par2Random, 48, 70);
  }
  public static StructureBoundingBox func_35027_a(
      List list, Random random, int i, int j, int k, int l) {
    StructureBoundingBox structureboundingbox = new StructureBoundingBox(i, j - 5, k, i, j + 2, k);
    switch (l) {
      case 2: // '\002'
        structureboundingbox.maxX = i + 2;
        structureboundingbox.minZ = k - 8;
        break;

      case 0: // '\0'
        structureboundingbox.maxX = i + 2;
        structureboundingbox.maxZ = k + 8;
        break;

      case 1: // '\001'
        structureboundingbox.minX = i - 8;
        structureboundingbox.maxZ = k + 2;
        break;

      case 3: // '\003'
        structureboundingbox.maxX = i + 8;
        structureboundingbox.maxZ = k + 2;
        break;
    }
    if (StructureComponent.getIntersectingStructureComponent(list, structureboundingbox) != null) {
      return null;
    } else {
      return structureboundingbox;
    }
  }
 /**
  * Creates and returns a new component piece. Or null if it could not find enough room to place
  * it.
  */
 public static ComponentNetherBridgeStraight createValidComponent(
     List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) {
   StructureBoundingBox var7 =
       StructureBoundingBox.getComponentToAddBoundingBox(
           par2, par3, par4, -1, -3, 0, 5, 10, 19, par5);
   return isAboveGround(var7) && StructureComponent.findIntersecting(par0List, var7) == null
       ? new ComponentNetherBridgeStraight(par6, par1Random, var7, par5)
       : null;
 }
 public static ComponentStrongholdPortalRoom findValidPlacement(
     List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) {
   StructureBoundingBox var7 =
       StructureBoundingBox.getComponentToAddBoundingBox(
           par2, par3, par4, -4, -1, 0, 11, 8, 16, par5);
   return canStrongholdGoDeeper(var7)
           && StructureComponent.findIntersecting(par0List, var7) == null
       ? new ComponentStrongholdPortalRoom(par6, par1Random, var7, par5)
       : null;
 }
 public static ComponentStrongholdStairs func_35034_a(
     List list, Random random, int i, int j, int k, int l, int i1) {
   StructureBoundingBox structureboundingbox =
       StructureBoundingBox.func_35747_a(i, j, k, -1, -7, 0, 5, 11, 5, l);
   if (!func_35030_a(structureboundingbox)
       || StructureComponent.func_35020_a(list, structureboundingbox) != null) {
     return null;
   } else {
     return new ComponentStrongholdStairs(i1, random, structureboundingbox, l);
   }
 }
  public static ComponentStrongholdLibrary findValidPlacement(
      List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) {
    StructureBoundingBox var7 =
        StructureBoundingBox.getComponentToAddBoundingBox(
            par2, par3, par4, -4, -1, 0, 14, 11, 15, par5);

    if (!canStrongholdGoDeeper(var7)
        || StructureComponent.findIntersecting(par0List, var7) != null) {
      var7 =
          StructureBoundingBox.getComponentToAddBoundingBox(
              par2, par3, par4, -4, -1, 0, 14, 6, 15, par5);

      if (!canStrongholdGoDeeper(var7)
          || StructureComponent.findIntersecting(par0List, var7) != null) {
        return null;
      }
    }

    return new ComponentStrongholdLibrary(par6, par1Random, var7, par5);
  }
 public static ComponentNetherBridgeCorridor func_40038_a(
     List list, Random random, int i, int j, int k, int l, int i1) {
   StructureBoundingBox structureboundingbox =
       StructureBoundingBox.getComponentToAddBoundingBox(i, j, k, -1, 0, 0, 5, 7, 5, l);
   if (!func_40021_a(structureboundingbox)
       || StructureComponent.getIntersectingStructureComponent(list, structureboundingbox)
           != null) {
     return null;
   } else {
     return new ComponentNetherBridgeCorridor(i1, random, structureboundingbox, l);
   }
 }
  public static ComponentStrongholdChestCorridor findValidPlacement(
      List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) {
    StructureBoundingBox structureboundingbox =
        StructureBoundingBox.getComponentToAddBoundingBox(
            par2, par3, par4, -1, -1, 0, 5, 5, 7, par5);

    if (!canStrongholdGoDeeper(structureboundingbox)
        || StructureComponent.findIntersecting(par0List, structureboundingbox) != null) {
      return null;
    } else {
      return new ComponentStrongholdChestCorridor(par6, par1Random, structureboundingbox, par5);
    }
  }
  /**
   * Creates and returns a new component piece. Or null if it could not find enough room to place
   * it.
   */
  public static ComponentNetherBridgeCorridor2 createValidComponent(
      List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) {
    StructureBoundingBox structureboundingbox =
        StructureBoundingBox.getComponentToAddBoundingBox(
            par2, par3, par4, -1, 0, 0, 5, 7, 5, par5);

    if (!isAboveGround(structureboundingbox)
        || StructureComponent.findIntersecting(par0List, structureboundingbox) != null) {
      return null;
    } else {
      return new ComponentNetherBridgeCorridor2(par6, par1Random, structureboundingbox, par5);
    }
  }
 /** current Position depends on currently set Coordinates mode, is computed here */
 protected void placeBlockAtCurrentPosition(
     World par1World,
     int par2,
     int par3,
     int par4,
     int par5,
     int par6,
     StructureBoundingBox par7StructureBoundingBox) {
   int var8 = this.func_74890_d(par2, par3);
   int var9 = this.func_74892_e(par2, par3);
   super.placeBlockAtCurrentPosition(
       par1World, var8, var9, par4, par5, par6, par7StructureBoundingBox);
 }
Beispiel #13
0
  /**
   * Returns true if the structure generator has generated a structure located at the given position
   * tuple.
   */
  public boolean hasStructureAt(int par1, int par2, int par3) {
    Iterator var4 = this.structureMap.values().iterator();

    while (var4.hasNext()) {
      StructureStart var5 = (StructureStart) var4.next();

      if (var5.isSizeableStructure()
          && var5.getBoundingBox().intersectsWith(par1, par3, par1, par3)) {
        Iterator var6 = var5.getComponents().iterator();

        while (var6.hasNext()) {
          StructureComponent var7 = (StructureComponent) var6.next();

          if (var7.getBoundingBox().isVecInside(par1, par2, par3)) {
            return true;
          }
        }
      }
    }

    return false;
  }
 /**
  * Overwrites air and liquids from selected position downwards, stops at hitting anything else.
  */
 protected void fillCurrentPositionBlocksDownwards(
     World par1World,
     int par2,
     int par3,
     int par4,
     int par5,
     int par6,
     StructureBoundingBox par7StructureBoundingBox) {
   int var8 = this.func_74890_d(par2, par3);
   int var9 = this.func_74892_e(par2, par3);
   super.fillCurrentPositionBlocksDownwards(
       par1World, var8, var9, par4, par5, par6, par7StructureBoundingBox);
 }
  public static StructureBoundingBox findValidPlacement(
      List par0List, Random par1Random, int par2, int par3, int par4, int par5) {
    StructureBoundingBox structureboundingbox =
        new StructureBoundingBox(par2, par3, par4, par2, par3 + 2, par4);
    int i = par1Random.nextInt(3) + 2;

    do {
      if (i <= 0) {
        break;
      }

      int j = i * 5;

      switch (par5) {
        case 2:
          structureboundingbox.maxX = par2 + 2;
          structureboundingbox.minZ = par4 - (j - 1);
          break;

        case 0:
          structureboundingbox.maxX = par2 + 2;
          structureboundingbox.maxZ = par4 + (j - 1);
          break;

        case 1:
          structureboundingbox.minX = par2 - (j - 1);
          structureboundingbox.maxZ = par4 + 2;
          break;

        case 3:
          structureboundingbox.maxX = par2 + (j - 1);
          structureboundingbox.maxZ = par4 + 2;
          break;
      }

      if (StructureComponent.findIntersecting(par0List, structureboundingbox) == null) {
        break;
      }

      i--;
    } while (true);

    if (i > 0) {
      return structureboundingbox;
    } else {
      return null;
    }
  }
  public static StructureBoundingBox func_35066_a(
      List p_35066_0_,
      Random p_35066_1_,
      int p_35066_2_,
      int p_35066_3_,
      int p_35066_4_,
      int p_35066_5_) {
    StructureBoundingBox structureboundingbox =
        new StructureBoundingBox(
            p_35066_2_, p_35066_3_, p_35066_4_, p_35066_2_, p_35066_3_ + 2, p_35066_4_);
    int i = p_35066_1_.nextInt(3) + 2;
    do {
      if (i <= 0) {
        break;
      }
      int j = i * 5;
      switch (p_35066_5_) {
        case 2: // '\002'
          structureboundingbox.field_35749_d = p_35066_2_ + 2;
          structureboundingbox.field_35752_c = p_35066_4_ - (j - 1);
          break;

        case 0: // '\0'
          structureboundingbox.field_35749_d = p_35066_2_ + 2;
          structureboundingbox.field_35748_f = p_35066_4_ + (j - 1);
          break;

        case 1: // '\001'
          structureboundingbox.field_35753_a = p_35066_2_ - (j - 1);
          structureboundingbox.field_35748_f = p_35066_4_ + 2;
          break;

        case 3: // '\003'
          structureboundingbox.field_35749_d = p_35066_2_ + (j - 1);
          structureboundingbox.field_35748_f = p_35066_4_ + 2;
          break;
      }
      if (StructureComponent.func_35020_a(p_35066_0_, structureboundingbox) == null) {
        break;
      }
      i--;
    } while (true);
    if (i > 0) {
      return structureboundingbox;
    } else {
      return null;
    }
  }
 public static ComponentStrongholdCrossing func_35039_a(
     List p_35039_0_,
     Random p_35039_1_,
     int p_35039_2_,
     int p_35039_3_,
     int p_35039_4_,
     int p_35039_5_,
     int p_35039_6_) {
   StructureBoundingBox structureboundingbox =
       StructureBoundingBox.func_35747_a(
           p_35039_2_, p_35039_3_, p_35039_4_, -4, -3, 0, 10, 9, 11, p_35039_5_);
   if (!func_35030_a(structureboundingbox)
       || StructureComponent.func_35020_a(p_35039_0_, structureboundingbox) != null) {
     return null;
   } else {
     return new ComponentStrongholdCrossing(
         p_35039_6_, p_35039_1_, structureboundingbox, p_35039_5_);
   }
 }
 public static ComponentStrongholdCrossing func_74994_a(
     List p_74994_0_,
     Random p_74994_1_,
     int p_74994_2_,
     int p_74994_3_,
     int p_74994_4_,
     int p_74994_5_,
     int p_74994_6_) {
   StructureBoundingBox structureboundingbox =
       StructureBoundingBox.func_78889_a(
           p_74994_2_, p_74994_3_, p_74994_4_, -4, -3, 0, 10, 9, 11, p_74994_5_);
   if (!func_74991_a(structureboundingbox)
       || StructureComponent.func_74883_a(p_74994_0_, structureboundingbox) != null) {
     return null;
   } else {
     return new ComponentStrongholdCrossing(
         p_74994_6_, p_74994_1_, structureboundingbox, p_74994_5_);
   }
 }
 public static ComponentNetherBridgeNetherStalkRoom func_74977_a(
     List p_74977_0_,
     Random p_74977_1_,
     int p_74977_2_,
     int p_74977_3_,
     int p_74977_4_,
     int p_74977_5_,
     int p_74977_6_) {
   StructureBoundingBox structureboundingbox =
       StructureBoundingBox.func_78889_a(
           p_74977_2_, p_74977_3_, p_74977_4_, -5, -3, 0, 13, 14, 13, p_74977_5_);
   if (!func_74964_a(structureboundingbox)
       || StructureComponent.func_74883_a(p_74977_0_, structureboundingbox) != null) {
     return null;
   } else {
     return new ComponentNetherBridgeNetherStalkRoom(
         p_74977_6_, p_74977_1_, structureboundingbox, p_74977_5_);
   }
 }
 public static ComponentNetherBridgeCrossing func_74974_a(
     List p_74974_0_,
     Random p_74974_1_,
     int p_74974_2_,
     int p_74974_3_,
     int p_74974_4_,
     int p_74974_5_,
     int p_74974_6_) {
   StructureBoundingBox structureboundingbox =
       StructureBoundingBox.func_78889_a(
           p_74974_2_, p_74974_3_, p_74974_4_, -2, 0, 0, 7, 9, 7, p_74974_5_);
   if (!func_74964_a(structureboundingbox)
       || StructureComponent.func_74883_a(p_74974_0_, structureboundingbox) != null) {
     return null;
   } else {
     return new ComponentNetherBridgeCrossing(
         p_74974_6_, p_74974_1_, structureboundingbox, p_74974_5_);
   }
 }
  public static StructureBoundingBox func_35027_a(
      List p_35027_0_,
      Random p_35027_1_,
      int p_35027_2_,
      int p_35027_3_,
      int p_35027_4_,
      int p_35027_5_) {
    StructureBoundingBox structureboundingbox =
        new StructureBoundingBox(
            p_35027_2_, p_35027_3_ - 5, p_35027_4_, p_35027_2_, p_35027_3_ + 2, p_35027_4_);
    switch (p_35027_5_) {
      case 2: // '\002'
        structureboundingbox.field_35749_d = p_35027_2_ + 2;
        structureboundingbox.field_35752_c = p_35027_4_ - 8;
        break;

      case 0: // '\0'
        structureboundingbox.field_35749_d = p_35027_2_ + 2;
        structureboundingbox.field_35748_f = p_35027_4_ + 8;
        break;

      case 1: // '\001'
        structureboundingbox.field_35753_a = p_35027_2_ - 8;
        structureboundingbox.field_35748_f = p_35027_4_ + 2;
        break;

      case 3: // '\003'
        structureboundingbox.field_35749_d = p_35027_2_ + 8;
        structureboundingbox.field_35748_f = p_35027_4_ + 2;
        break;
    }
    if (StructureComponent.func_35020_a(p_35027_0_, structureboundingbox) != null) {
      return null;
    } else {
      return structureboundingbox;
    }
  }
Beispiel #22
0
  public ChunkPosition getNearestInstance(World par1World, int par2, int par3, int par4) {
    this.worldObj = par1World;
    this.rand.setSeed(par1World.getSeed());
    long var5 = this.rand.nextLong();
    long var7 = this.rand.nextLong();
    long var9 = (long) (par2 >> 4) * var5;
    long var11 = (long) (par4 >> 4) * var7;
    this.rand.setSeed(var9 ^ var11 ^ par1World.getSeed());
    this.recursiveGenerate(par1World, par2 >> 4, par4 >> 4, 0, 0, (byte[]) null);
    double var13 = Double.MAX_VALUE;
    ChunkPosition var15 = null;
    Iterator var16 = this.structureMap.values().iterator();
    ChunkPosition var19;
    int var21;
    int var20;
    double var23;
    int var22;

    while (var16.hasNext()) {
      StructureStart var17 = (StructureStart) var16.next();

      if (var17.isSizeableStructure()) {
        StructureComponent var18 = (StructureComponent) var17.getComponents().get(0);
        var19 = var18.getCenter();
        var20 = var19.x - par2;
        var21 = var19.y - par3;
        var22 = var19.z - par4;
        var23 = (double) (var20 * var20 + var21 * var21 + var22 * var22);

        if (var23 < var13) {
          var13 = var23;
          var15 = var19;
        }
      }
    }

    if (var15 != null) {
      return var15;
    } else {
      List var25 = this.getCoordList();

      if (var25 != null) {
        ChunkPosition var26 = null;
        Iterator var27 = var25.iterator();

        while (var27.hasNext()) {
          var19 = (ChunkPosition) var27.next();
          var20 = var19.x - par2;
          var21 = var19.y - par3;
          var22 = var19.z - par4;
          var23 = (double) (var20 * var20 + var21 * var21 + var22 * var22);

          if (var23 < var13) {
            var13 = var23;
            var26 = var19;
          }
        }

        return var26;
      } else {
        return null;
      }
    }
  }