예제 #1
0
  public void a(World world, BlockPosition blockposition, TileEntitySkull tileentityskull) {
    if (world.captureBlockStates) return; // CraftBukkit
    if (tileentityskull.getSkullType() == 1
        && blockposition.getY() >= 2
        && world.getDifficulty() != EnumDifficulty.PEACEFUL
        && !world.isStatic) {
      ShapeDetector shapedetector = this.l();
      ShapeDetectorCollection shapedetectorcollection = shapedetector.a(world, blockposition);

      if (shapedetectorcollection != null) {
        // CraftBukkit start - Use BlockStateListPopulator
        BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
        int i;

        for (i = 0; i < 3; ++i) {
          ShapeDetectorBlock shapedetectorblock = shapedetectorcollection.a(i, 0, 0);

          // CraftBukkit start
          // world.setTypeAndData(shapedetectorblock.d(),
          // shapedetectorblock.a().set(BlockSkull.NODROP, Boolean.valueOf(true)), 2);
          BlockPosition pos = shapedetectorblock.d();
          IBlockData data = shapedetectorblock.a().set(BlockSkull.NODROP, Boolean.valueOf(true));
          blockList.setTypeAndData(
              pos.getX(),
              pos.getY(),
              pos.getZ(),
              data.getBlock(),
              data.getBlock().toLegacyData(data),
              2);
          // CraftBukkit end
        }

        for (i = 0; i < shapedetector.c(); ++i) {
          for (int j = 0; j < shapedetector.b(); ++j) {
            ShapeDetectorBlock shapedetectorblock1 = shapedetectorcollection.a(i, j, 0);

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

        BlockPosition blockposition1 = shapedetectorcollection.a(1, 0, 0).d();
        EntityWither entitywither = new EntityWither(world);
        BlockPosition blockposition2 = shapedetectorcollection.a(1, 2, 0).d();

        entitywither.setPositionRotation(
            (double) blockposition2.getX() + 0.5D,
            (double) blockposition2.getY() + 0.55D,
            (double) blockposition2.getZ() + 0.5D,
            shapedetectorcollection.b().k() == EnumAxis.X ? 0.0F : 90.0F,
            0.0F);
        entitywither.aG = shapedetectorcollection.b().k() == EnumAxis.X ? 0.0F : 90.0F;
        entitywither.n();
        Iterator iterator =
            world
                .a(EntityHuman.class, entitywither.getBoundingBox().grow(50.0D, 50.0D, 50.0D))
                .iterator();

        // CraftBukkit start
        if (world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {
          while (iterator.hasNext()) {
            EntityHuman entityhuman = (EntityHuman) iterator.next();

            entityhuman.b((Statistic) AchievementList.I);
          }

          blockList.updateList();

          int k;

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

          for (k = 0; k < shapedetector.c(); ++k) {
            for (int l = 0; l < shapedetector.b(); ++l) {
              ShapeDetectorBlock shapedetectorblock2 = shapedetectorcollection.a(k, l, 0);

              world.update(shapedetectorblock2.d(), Blocks.AIR);
            }
          }
        }
        // CraftBukkit end
      }
    }
  }
예제 #2
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
    }
  }