Esempio n. 1
0
  private void f(World world, BlockPosition blockposition) {
    ShapeDetector.ShapeDetectorCollection shapedetector_shapedetectorcollection;
    int i;
    int j;

    if ((shapedetector_shapedetectorcollection =
            this.getDetectorSnowGolem().a(world, blockposition))
        != null) {
      BlockStateListPopulator blockList =
          new BlockStateListPopulator(
              world.getWorld()); // CraftBukkit - Use BlockStateListPopulator
      for (i = 0; i < this.getDetectorSnowGolem().b(); ++i) {
        ShapeDetectorBlock shapedetectorblock = shapedetector_shapedetectorcollection.a(0, i, 0);

        // CraftBukkit start
        // world.setTypeAndData(shapedetectorblock.d(), Blocks.AIR.getBlockData(), 2);
        BlockPosition pos = shapedetectorblock.getPosition();
        blockList.setTypeId(pos.getX(), pos.getY(), pos.getZ(), 0);
        // CraftBukkit end
      }

      EntitySnowman entitysnowman = new EntitySnowman(world);
      BlockPosition blockposition1 = shapedetector_shapedetectorcollection.a(0, 2, 0).getPosition();

      entitysnowman.setPositionRotation(
          (double) blockposition1.getX() + 0.5D,
          (double) blockposition1.getY() + 0.05D,
          (double) blockposition1.getZ() + 0.5D,
          0.0F,
          0.0F);
      // CraftBukkit start
      if (world.addEntity(entitysnowman, SpawnReason.BUILD_SNOWMAN)) {
        blockList.updateList();

        for (j = 0; j < 120; ++j) {
          world.addParticle(
              EnumParticle.SNOW_SHOVEL,
              (double) blockposition1.getX() + world.random.nextDouble(),
              (double) blockposition1.getY() + world.random.nextDouble() * 2.5D,
              (double) blockposition1.getZ() + world.random.nextDouble(),
              0.0D,
              0.0D,
              0.0D,
              new int[0]);
        }

        for (j = 0; j < this.getDetectorSnowGolem().b(); ++j) {
          ShapeDetectorBlock shapedetectorblock1 = shapedetector_shapedetectorcollection.a(0, j, 0);

          world.update(shapedetectorblock1.getPosition(), Blocks.AIR);
        }
      } // CraftBukkit end
    } else if ((shapedetector_shapedetectorcollection =
            this.getDetectorIronGolem().a(world, blockposition))
        != null) {
      BlockStateListPopulator blockList =
          new BlockStateListPopulator(
              world.getWorld()); // CraftBukkit - Use BlockStateListPopulator
      for (i = 0; i < this.getDetectorIronGolem().c(); ++i) {
        for (int k = 0; k < this.getDetectorIronGolem().b(); ++k) {
          // CraftBukkit start
          // world.setTypeAndData(shapedetectorcollection.a(i, k, 0).d(), Blocks.AIR.getBlockData(),
          // 2);
          BlockPosition pos = shapedetector_shapedetectorcollection.a(i, k, 0).getPosition();
          blockList.setTypeId(pos.getX(), pos.getY(), pos.getZ(), 0);
          // CraftBukkit end
        }
      }

      BlockPosition blockposition2 = shapedetector_shapedetectorcollection.a(1, 2, 0).getPosition();
      EntityIronGolem entityirongolem = new EntityIronGolem(world);

      entityirongolem.setPlayerCreated(true);
      entityirongolem.setPositionRotation(
          (double) blockposition2.getX() + 0.5D,
          (double) blockposition2.getY() + 0.05D,
          (double) blockposition2.getZ() + 0.5D,
          0.0F,
          0.0F);

      // CraftBukkit start
      if (world.addEntity(entityirongolem, SpawnReason.BUILD_IRONGOLEM)) {
        blockList.updateList();

        for (j = 0; j < 120; ++j) {
          world.addParticle(
              EnumParticle.SNOWBALL,
              (double) blockposition2.getX() + world.random.nextDouble(),
              (double) blockposition2.getY() + world.random.nextDouble() * 3.9D,
              (double) blockposition2.getZ() + world.random.nextDouble(),
              0.0D,
              0.0D,
              0.0D,
              new int[0]);
        }

        for (j = 0; j < this.getDetectorIronGolem().c(); ++j) {
          for (int l = 0; l < this.getDetectorIronGolem().b(); ++l) {
            ShapeDetectorBlock shapedetectorblock2 =
                shapedetector_shapedetectorcollection.a(j, l, 0);

            world.update(shapedetectorblock2.getPosition(), Blocks.AIR);
          }
        }
      } // CraftBukkit end
    }
  }
Esempio n. 2
0
  private void f(World var1, BlockPosition var2) {
    ShapeDetector.ShapeDetectorCollection var3;
    int var4;
    int var6;
    if ((var3 = this.getDetectorSnowGolem().a(var1, var2)) != null) {
      for (var4 = 0; var4 < this.getDetectorSnowGolem().b(); ++var4) {
        ShapeDetectorBlock var5 = var3.a(0, var4, 0);
        var1.setTypeAndData(var5.d(), Blocks.AIR.getBlockData(), 2);
      }

      EntitySnowman var9 = new EntitySnowman(var1);
      BlockPosition var10 = var3.a(0, 2, 0).d();
      var9.setPositionRotation(
          (double) var10.getX() + 0.5D,
          (double) var10.getY() + 0.05D,
          (double) var10.getZ() + 0.5D,
          0.0F,
          0.0F);
      var1.addEntity(var9);

      for (var6 = 0; var6 < 120; ++var6) {
        var1.addParticle(
            EnumParticle.SNOW_SHOVEL,
            (double) var10.getX() + var1.random.nextDouble(),
            (double) var10.getY() + var1.random.nextDouble() * 2.5D,
            (double) var10.getZ() + var1.random.nextDouble(),
            0.0D,
            0.0D,
            0.0D,
            new int[0]);
      }

      for (var6 = 0; var6 < this.getDetectorSnowGolem().b(); ++var6) {
        ShapeDetectorBlock var7 = var3.a(0, var6, 0);
        var1.update(var7.d(), Blocks.AIR);
      }
    } else if ((var3 = this.getDetectorIronGolem().a(var1, var2)) != null) {
      for (var4 = 0; var4 < this.getDetectorIronGolem().c(); ++var4) {
        for (int var12 = 0; var12 < this.getDetectorIronGolem().b(); ++var12) {
          var1.setTypeAndData(var3.a(var4, var12, 0).d(), Blocks.AIR.getBlockData(), 2);
        }
      }

      BlockPosition var11 = var3.a(1, 2, 0).d();
      EntityIronGolem var13 = new EntityIronGolem(var1);
      var13.setPlayerCreated(true);
      var13.setPositionRotation(
          (double) var11.getX() + 0.5D,
          (double) var11.getY() + 0.05D,
          (double) var11.getZ() + 0.5D,
          0.0F,
          0.0F);
      var1.addEntity(var13);

      for (var6 = 0; var6 < 120; ++var6) {
        var1.addParticle(
            EnumParticle.SNOWBALL,
            (double) var11.getX() + var1.random.nextDouble(),
            (double) var11.getY() + var1.random.nextDouble() * 3.9D,
            (double) var11.getZ() + var1.random.nextDouble(),
            0.0D,
            0.0D,
            0.0D,
            new int[0]);
      }

      for (var6 = 0; var6 < this.getDetectorIronGolem().c(); ++var6) {
        for (int var14 = 0; var14 < this.getDetectorIronGolem().b(); ++var14) {
          ShapeDetectorBlock var8 = var3.a(var6, var14, 0);
          var1.update(var8.d(), Blocks.AIR);
        }
      }
    }
  }