コード例 #1
0
  protected void placeSpawnerAtCurrentPosition(
      World var1,
      Random var2,
      int var3,
      int var4,
      int var5,
      String var6,
      StructureBoundingBox var7) {
    int var8 = this.getXWithOffset(var3, var5);
    int var9 = this.getYWithOffset(var4);
    int var10 = this.getZWithOffset(var3, var5);

    if (var7.isVecInside(var8, var9, var10)
        && var1.getBlockId(var8, var9, var10) != Block.mobSpawner.blockID) {
      var1.setBlockWithNotify(var8, var9, var10, Block.mobSpawner.blockID);
      TileEntityMobSpawner var11 =
          (TileEntityMobSpawner) var1.getBlockTileEntity(var8, var9, var10);

      if (var11 != null) {
        var11.setMobID(var6);
      }
    }
  }
コード例 #2
0
  /**
   * 'second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it
   * closes Mineshafts at the end, it adds Fences...'
   */
  public boolean addComponentParts(
      World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) {
    if (isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) {
      return false;
    }

    int i = sectionCount * 5 - 1;
    fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 2, 1, i, 0, 0, false);
    randomlyFillWithBlocks(
        par1World, par3StructureBoundingBox, par2Random, 0.8F, 0, 2, 0, 2, 2, i, 0, 0, false);

    if (hasSpiders) {
      randomlyFillWithBlocks(
          par1World,
          par3StructureBoundingBox,
          par2Random,
          0.6F,
          0,
          0,
          0,
          2,
          1,
          i,
          Block.web.blockID,
          0,
          false);
    }

    for (int j = 0; j < sectionCount; j++) {
      int i1 = 2 + j * 5;
      fillWithBlocks(
          par1World, par3StructureBoundingBox, 0, 0, i1, 0, 1, i1, Block.fence.blockID, 0, false);
      fillWithBlocks(
          par1World, par3StructureBoundingBox, 2, 0, i1, 2, 1, i1, Block.fence.blockID, 0, false);

      if (par2Random.nextInt(4) != 0) {
        fillWithBlocks(
            par1World,
            par3StructureBoundingBox,
            0,
            2,
            i1,
            2,
            2,
            i1,
            Block.planks.blockID,
            0,
            false);
      } else {
        fillWithBlocks(
            par1World,
            par3StructureBoundingBox,
            0,
            2,
            i1,
            0,
            2,
            i1,
            Block.planks.blockID,
            0,
            false);
        fillWithBlocks(
            par1World,
            par3StructureBoundingBox,
            2,
            2,
            i1,
            2,
            2,
            i1,
            Block.planks.blockID,
            0,
            false);
      }

      randomlyPlaceBlock(
          par1World,
          par3StructureBoundingBox,
          par2Random,
          0.1F,
          0,
          2,
          i1 - 1,
          Block.web.blockID,
          0);
      randomlyPlaceBlock(
          par1World,
          par3StructureBoundingBox,
          par2Random,
          0.1F,
          2,
          2,
          i1 - 1,
          Block.web.blockID,
          0);
      randomlyPlaceBlock(
          par1World,
          par3StructureBoundingBox,
          par2Random,
          0.1F,
          0,
          2,
          i1 + 1,
          Block.web.blockID,
          0);
      randomlyPlaceBlock(
          par1World,
          par3StructureBoundingBox,
          par2Random,
          0.1F,
          2,
          2,
          i1 + 1,
          Block.web.blockID,
          0);
      randomlyPlaceBlock(
          par1World,
          par3StructureBoundingBox,
          par2Random,
          0.05F,
          0,
          2,
          i1 - 2,
          Block.web.blockID,
          0);
      randomlyPlaceBlock(
          par1World,
          par3StructureBoundingBox,
          par2Random,
          0.05F,
          2,
          2,
          i1 - 2,
          Block.web.blockID,
          0);
      randomlyPlaceBlock(
          par1World,
          par3StructureBoundingBox,
          par2Random,
          0.05F,
          0,
          2,
          i1 + 2,
          Block.web.blockID,
          0);
      randomlyPlaceBlock(
          par1World,
          par3StructureBoundingBox,
          par2Random,
          0.05F,
          2,
          2,
          i1 + 2,
          Block.web.blockID,
          0);
      randomlyPlaceBlock(
          par1World,
          par3StructureBoundingBox,
          par2Random,
          0.05F,
          1,
          2,
          i1 - 1,
          Block.torchWood.blockID,
          0);
      randomlyPlaceBlock(
          par1World,
          par3StructureBoundingBox,
          par2Random,
          0.05F,
          1,
          2,
          i1 + 1,
          Block.torchWood.blockID,
          0);

      if (par2Random.nextInt(100) == 0) {
        createTreasureChestAtCurrentPosition(
            par1World,
            par3StructureBoundingBox,
            par2Random,
            2,
            0,
            i1 - 1,
            StructureMineshaftPieces.getTreasurePieces(),
            3 + par2Random.nextInt(4));
      }

      if (par2Random.nextInt(100) == 0) {
        createTreasureChestAtCurrentPosition(
            par1World,
            par3StructureBoundingBox,
            par2Random,
            0,
            0,
            i1 + 1,
            StructureMineshaftPieces.getTreasurePieces(),
            3 + par2Random.nextInt(4));
      }

      if (!hasSpiders || spawnerPlaced) {
        continue;
      }

      int l1 = getYWithOffset(0);
      int j2 = (i1 - 1) + par2Random.nextInt(3);
      int k2 = getXWithOffset(1, j2);
      j2 = getZWithOffset(1, j2);

      if (!par3StructureBoundingBox.isVecInside(k2, l1, j2)) {
        continue;
      }

      spawnerPlaced = true;
      par1World.setBlockWithNotify(k2, l1, j2, Block.mobSpawner.blockID);
      TileEntityMobSpawner tileentitymobspawner =
          (TileEntityMobSpawner) par1World.getBlockTileEntity(k2, l1, j2);

      if (tileentitymobspawner != null) {
        tileentitymobspawner.setMobID("CaveSpider");
      }
    }

    for (int k = 0; k <= 2; k++) {
      for (int j1 = 0; j1 <= i; j1++) {
        int i2 = getBlockIdAtCurrentPosition(par1World, k, -1, j1, par3StructureBoundingBox);

        if (i2 == 0) {
          placeBlockAtCurrentPosition(
              par1World, Block.planks.blockID, 0, k, -1, j1, par3StructureBoundingBox);
        }
      }
    }

    if (hasRails) {
      for (int l = 0; l <= i; l++) {
        int k1 = getBlockIdAtCurrentPosition(par1World, 1, -1, l, par3StructureBoundingBox);

        if (k1 > 0 && Block.opaqueCubeLookup[k1]) {
          randomlyPlaceBlock(
              par1World,
              par3StructureBoundingBox,
              par2Random,
              0.7F,
              1,
              0,
              l,
              Block.rail.blockID,
              getMetadataWithOffset(Block.rail.blockID, 0));
        }
      }
    }

    return true;
  }
  /**
   * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it
   * closes Mineshafts at the end, it adds Fences...
   */
  public boolean addComponentParts(
      World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) {
    this.fillWithRandomizedBlocks(
        par1World,
        par3StructureBoundingBox,
        0,
        0,
        0,
        10,
        7,
        15,
        false,
        par2Random,
        StructureStrongholdPieces.getStrongholdStones());
    this.placeDoor(par1World, par2Random, par3StructureBoundingBox, EnumDoor.GRATES, 4, 1, 0);
    byte var4 = 6;
    this.fillWithRandomizedBlocks(
        par1World,
        par3StructureBoundingBox,
        1,
        var4,
        1,
        1,
        var4,
        14,
        false,
        par2Random,
        StructureStrongholdPieces.getStrongholdStones());
    this.fillWithRandomizedBlocks(
        par1World,
        par3StructureBoundingBox,
        9,
        var4,
        1,
        9,
        var4,
        14,
        false,
        par2Random,
        StructureStrongholdPieces.getStrongholdStones());
    this.fillWithRandomizedBlocks(
        par1World,
        par3StructureBoundingBox,
        2,
        var4,
        1,
        8,
        var4,
        2,
        false,
        par2Random,
        StructureStrongholdPieces.getStrongholdStones());
    this.fillWithRandomizedBlocks(
        par1World,
        par3StructureBoundingBox,
        2,
        var4,
        14,
        8,
        var4,
        14,
        false,
        par2Random,
        StructureStrongholdPieces.getStrongholdStones());
    this.fillWithRandomizedBlocks(
        par1World,
        par3StructureBoundingBox,
        1,
        1,
        1,
        2,
        1,
        4,
        false,
        par2Random,
        StructureStrongholdPieces.getStrongholdStones());
    this.fillWithRandomizedBlocks(
        par1World,
        par3StructureBoundingBox,
        8,
        1,
        1,
        9,
        1,
        4,
        false,
        par2Random,
        StructureStrongholdPieces.getStrongholdStones());
    this.fillWithBlocks(
        par1World,
        par3StructureBoundingBox,
        1,
        1,
        1,
        1,
        1,
        3,
        Block.lavaMoving.blockID,
        Block.lavaMoving.blockID,
        false);
    this.fillWithBlocks(
        par1World,
        par3StructureBoundingBox,
        9,
        1,
        1,
        9,
        1,
        3,
        Block.lavaMoving.blockID,
        Block.lavaMoving.blockID,
        false);
    this.fillWithRandomizedBlocks(
        par1World,
        par3StructureBoundingBox,
        3,
        1,
        8,
        7,
        1,
        12,
        false,
        par2Random,
        StructureStrongholdPieces.getStrongholdStones());
    this.fillWithBlocks(
        par1World,
        par3StructureBoundingBox,
        4,
        1,
        9,
        6,
        1,
        11,
        Block.lavaMoving.blockID,
        Block.lavaMoving.blockID,
        false);
    int var5;

    for (var5 = 3; var5 < 14; var5 += 2) {
      this.fillWithBlocks(
          par1World,
          par3StructureBoundingBox,
          0,
          3,
          var5,
          0,
          4,
          var5,
          Block.fenceIron.blockID,
          Block.fenceIron.blockID,
          false);
      this.fillWithBlocks(
          par1World,
          par3StructureBoundingBox,
          10,
          3,
          var5,
          10,
          4,
          var5,
          Block.fenceIron.blockID,
          Block.fenceIron.blockID,
          false);
    }

    for (var5 = 2; var5 < 9; var5 += 2) {
      this.fillWithBlocks(
          par1World,
          par3StructureBoundingBox,
          var5,
          3,
          15,
          var5,
          4,
          15,
          Block.fenceIron.blockID,
          Block.fenceIron.blockID,
          false);
    }

    var5 = this.getMetadataWithOffset(Block.stairsStoneBrickSmooth.blockID, 3);
    this.fillWithRandomizedBlocks(
        par1World,
        par3StructureBoundingBox,
        4,
        1,
        5,
        6,
        1,
        7,
        false,
        par2Random,
        StructureStrongholdPieces.getStrongholdStones());
    this.fillWithRandomizedBlocks(
        par1World,
        par3StructureBoundingBox,
        4,
        2,
        6,
        6,
        2,
        7,
        false,
        par2Random,
        StructureStrongholdPieces.getStrongholdStones());
    this.fillWithRandomizedBlocks(
        par1World,
        par3StructureBoundingBox,
        4,
        3,
        7,
        6,
        3,
        7,
        false,
        par2Random,
        StructureStrongholdPieces.getStrongholdStones());

    for (int var6 = 4; var6 <= 6; ++var6) {
      this.placeBlockAtCurrentPosition(
          par1World,
          Block.stairsStoneBrickSmooth.blockID,
          var5,
          var6,
          1,
          4,
          par3StructureBoundingBox);
      this.placeBlockAtCurrentPosition(
          par1World,
          Block.stairsStoneBrickSmooth.blockID,
          var5,
          var6,
          2,
          5,
          par3StructureBoundingBox);
      this.placeBlockAtCurrentPosition(
          par1World,
          Block.stairsStoneBrickSmooth.blockID,
          var5,
          var6,
          3,
          6,
          par3StructureBoundingBox);
    }

    byte var14 = 2;
    byte var7 = 0;
    byte var8 = 3;
    byte var9 = 1;

    switch (this.coordBaseMode) {
      case 0:
        var14 = 0;
        var7 = 2;
        break;

      case 1:
        var14 = 1;
        var7 = 3;
        var8 = 0;
        var9 = 2;

      case 2:
      default:
        break;

      case 3:
        var14 = 3;
        var7 = 1;
        var8 = 0;
        var9 = 2;
    }

    this.placeBlockAtCurrentPosition(
        par1World,
        Block.endPortalFrame.blockID,
        var14 + (par2Random.nextFloat() > 0.9F ? 4 : 0),
        4,
        3,
        8,
        par3StructureBoundingBox);
    this.placeBlockAtCurrentPosition(
        par1World,
        Block.endPortalFrame.blockID,
        var14 + (par2Random.nextFloat() > 0.9F ? 4 : 0),
        5,
        3,
        8,
        par3StructureBoundingBox);
    this.placeBlockAtCurrentPosition(
        par1World,
        Block.endPortalFrame.blockID,
        var14 + (par2Random.nextFloat() > 0.9F ? 4 : 0),
        6,
        3,
        8,
        par3StructureBoundingBox);
    this.placeBlockAtCurrentPosition(
        par1World,
        Block.endPortalFrame.blockID,
        var7 + (par2Random.nextFloat() > 0.9F ? 4 : 0),
        4,
        3,
        12,
        par3StructureBoundingBox);
    this.placeBlockAtCurrentPosition(
        par1World,
        Block.endPortalFrame.blockID,
        var7 + (par2Random.nextFloat() > 0.9F ? 4 : 0),
        5,
        3,
        12,
        par3StructureBoundingBox);
    this.placeBlockAtCurrentPosition(
        par1World,
        Block.endPortalFrame.blockID,
        var7 + (par2Random.nextFloat() > 0.9F ? 4 : 0),
        6,
        3,
        12,
        par3StructureBoundingBox);
    this.placeBlockAtCurrentPosition(
        par1World,
        Block.endPortalFrame.blockID,
        var8 + (par2Random.nextFloat() > 0.9F ? 4 : 0),
        3,
        3,
        9,
        par3StructureBoundingBox);
    this.placeBlockAtCurrentPosition(
        par1World,
        Block.endPortalFrame.blockID,
        var8 + (par2Random.nextFloat() > 0.9F ? 4 : 0),
        3,
        3,
        10,
        par3StructureBoundingBox);
    this.placeBlockAtCurrentPosition(
        par1World,
        Block.endPortalFrame.blockID,
        var8 + (par2Random.nextFloat() > 0.9F ? 4 : 0),
        3,
        3,
        11,
        par3StructureBoundingBox);
    this.placeBlockAtCurrentPosition(
        par1World,
        Block.endPortalFrame.blockID,
        var9 + (par2Random.nextFloat() > 0.9F ? 4 : 0),
        7,
        3,
        9,
        par3StructureBoundingBox);
    this.placeBlockAtCurrentPosition(
        par1World,
        Block.endPortalFrame.blockID,
        var9 + (par2Random.nextFloat() > 0.9F ? 4 : 0),
        7,
        3,
        10,
        par3StructureBoundingBox);
    this.placeBlockAtCurrentPosition(
        par1World,
        Block.endPortalFrame.blockID,
        var9 + (par2Random.nextFloat() > 0.9F ? 4 : 0),
        7,
        3,
        11,
        par3StructureBoundingBox);

    if (!this.hasSpawner) {
      int var13 = this.getYWithOffset(3);
      int var10 = this.getXWithOffset(5, 6);
      int var11 = this.getZWithOffset(5, 6);

      if (par3StructureBoundingBox.isVecInside(var10, var13, var11)) {
        this.hasSpawner = true;
        par1World.setBlockWithNotify(var10, var13, var11, Block.mobSpawner.blockID);
        TileEntityMobSpawner var12 =
            (TileEntityMobSpawner) par1World.getBlockTileEntity(var10, var13, var11);

        if (var12 != null) {
          var12.setMobID("Silverfish");
        }
      }
    }

    return true;
  }
コード例 #4
0
  public boolean func_35023_a(
      World p_35023_1_, Random p_35023_2_, StructureBoundingBox p_35023_3_) {
    if (func_35013_a(p_35023_1_, p_35023_3_)) {
      return false;
    }
    int i = field_35067_d * 5 - 1;
    func_35011_a(p_35023_1_, p_35023_3_, 0, 0, 0, 2, 1, i, 0, 0, false);
    func_35010_a(p_35023_1_, p_35023_3_, p_35023_2_, 0.8F, 0, 2, 0, 2, 2, i, 0, 0, false);
    if (field_35068_b) {
      func_35010_a(
          p_35023_1_,
          p_35023_3_,
          p_35023_2_,
          0.6F,
          0,
          0,
          0,
          2,
          1,
          i,
          Block.field_9258_W.field_376_bc,
          0,
          false);
    }
    for (int j = 0; j < field_35067_d; j++) {
      int i1 = 2 + j * 5;
      func_35011_a(
          p_35023_1_, p_35023_3_, 0, 0, i1, 0, 1, i1, Block.field_4057_ba.field_376_bc, 0, false);
      func_35011_a(
          p_35023_1_, p_35023_3_, 2, 0, i1, 2, 1, i1, Block.field_4057_ba.field_376_bc, 0, false);
      if (p_35023_2_.nextInt(4) != 0) {
        func_35011_a(
            p_35023_1_, p_35023_3_, 0, 2, i1, 2, 2, i1, Block.field_334_y.field_376_bc, 0, false);
      } else {
        func_35011_a(
            p_35023_1_, p_35023_3_, 0, 2, i1, 0, 2, i1, Block.field_334_y.field_376_bc, 0, false);
        func_35011_a(
            p_35023_1_, p_35023_3_, 2, 2, i1, 2, 2, i1, Block.field_334_y.field_376_bc, 0, false);
      }
      func_35014_a(
          p_35023_1_,
          p_35023_3_,
          p_35023_2_,
          0.1F,
          0,
          2,
          i1 - 1,
          Block.field_9258_W.field_376_bc,
          0);
      func_35014_a(
          p_35023_1_,
          p_35023_3_,
          p_35023_2_,
          0.1F,
          2,
          2,
          i1 - 1,
          Block.field_9258_W.field_376_bc,
          0);
      func_35014_a(
          p_35023_1_,
          p_35023_3_,
          p_35023_2_,
          0.1F,
          0,
          2,
          i1 + 1,
          Block.field_9258_W.field_376_bc,
          0);
      func_35014_a(
          p_35023_1_,
          p_35023_3_,
          p_35023_2_,
          0.1F,
          2,
          2,
          i1 + 1,
          Block.field_9258_W.field_376_bc,
          0);
      func_35014_a(
          p_35023_1_,
          p_35023_3_,
          p_35023_2_,
          0.05F,
          0,
          2,
          i1 - 2,
          Block.field_9258_W.field_376_bc,
          0);
      func_35014_a(
          p_35023_1_,
          p_35023_3_,
          p_35023_2_,
          0.05F,
          2,
          2,
          i1 - 2,
          Block.field_9258_W.field_376_bc,
          0);
      func_35014_a(
          p_35023_1_,
          p_35023_3_,
          p_35023_2_,
          0.05F,
          0,
          2,
          i1 + 2,
          Block.field_9258_W.field_376_bc,
          0);
      func_35014_a(
          p_35023_1_,
          p_35023_3_,
          p_35023_2_,
          0.05F,
          2,
          2,
          i1 + 2,
          Block.field_9258_W.field_376_bc,
          0);
      func_35014_a(
          p_35023_1_,
          p_35023_3_,
          p_35023_2_,
          0.05F,
          1,
          2,
          i1 - 1,
          Block.field_404_ar.field_376_bc,
          0);
      func_35014_a(
          p_35023_1_,
          p_35023_3_,
          p_35023_2_,
          0.05F,
          1,
          2,
          i1 + 1,
          Block.field_404_ar.field_376_bc,
          0);
      if (p_35023_2_.nextInt(100) == 0) {
        func_35003_a(
            p_35023_1_,
            p_35023_3_,
            p_35023_2_,
            2,
            0,
            i1 - 1,
            StructureMineshaftPieces.func_35588_a(),
            3 + p_35023_2_.nextInt(4));
      }
      if (p_35023_2_.nextInt(100) == 0) {
        func_35003_a(
            p_35023_1_,
            p_35023_3_,
            p_35023_2_,
            0,
            0,
            i1 + 1,
            StructureMineshaftPieces.func_35588_a(),
            3 + p_35023_2_.nextInt(4));
      }
      if (!field_35068_b || field_35069_c) {
        continue;
      }
      int l1 = func_35008_a(0);
      int j2 = (i1 - 1) + p_35023_2_.nextInt(3);
      int k2 = func_35017_a(1, j2);
      j2 = func_35006_b(1, j2);
      if (!p_35023_3_.func_35742_b(k2, l1, j2)) {
        continue;
      }
      field_35069_c = true;
      p_35023_1_.func_690_d(k2, l1, j2, Block.field_400_at.field_376_bc);
      TileEntityMobSpawner tileentitymobspawner =
          (TileEntityMobSpawner) p_35023_1_.func_603_b(k2, l1, j2);
      if (tileentitymobspawner != null) {
        tileentitymobspawner.func_21098_a("CaveSpider");
      }
    }

    for (int k = 0; k <= 2; k++) {
      for (int j1 = 0; j1 <= i; j1++) {
        int i2 = func_35007_a(p_35023_1_, k, -1, j1, p_35023_3_);
        if (i2 == 0) {
          func_35018_a(p_35023_1_, Block.field_334_y.field_376_bc, 0, k, -1, j1, p_35023_3_);
        }
      }
    }

    if (field_35070_a) {
      for (int l = 0; l <= i; l++) {
        int k1 = func_35007_a(p_35023_1_, 1, -1, l, p_35023_3_);
        if (k1 > 0 && Block.field_343_p[k1]) {
          func_35014_a(
              p_35023_1_,
              p_35023_3_,
              p_35023_2_,
              0.7F,
              1,
              0,
              l,
              Block.field_440_aH.field_376_bc,
              func_35009_c(Block.field_440_aH.field_376_bc, 0));
        }
      }
    }
    return true;
  }