Example #1
0
  protected ShapeDetector getDetectorIronGolemPart() {
    if (this.ironGolemPart == null) {
      this.ironGolemPart =
          ShapeDetectorBuilder.a()
              .a(new String[] {"~ ~", "###", "~#~"})
              .a('#', ShapeDetectorBlock.a(BlockStatePredicate.a(Blocks.IRON_BLOCK)))
              .a('~', ShapeDetectorBlock.a(BlockStatePredicate.a(Blocks.AIR)))
              .b();
    }

    return this.ironGolemPart;
  }
Example #2
0
  protected ShapeDetector getDetectorSnowGolem() {
    if (this.snowGolem == null) {
      this.snowGolem =
          ShapeDetectorBuilder.a()
              .a(new String[] {"^", "#", "#"})
              .a('^', ShapeDetectorBlock.a(Q))
              .a('#', ShapeDetectorBlock.a(BlockStatePredicate.a(Blocks.SNOW)))
              .b();
    }

    return this.snowGolem;
  }
Example #3
0
  public ShapeDetector.ShapeDetectorCollection f(World var1, BlockPosition var2) {
    EnumDirection.EnumAxis var3 = EnumDirection.EnumAxis.Z;
    BlockPortal.Shape var4 = new BlockPortal.Shape(var1, var2, EnumDirection.EnumAxis.X);
    LoadingCache var5 = ShapeDetector.a(var1, true);
    if (!var4.d()) {
      var3 = EnumDirection.EnumAxis.X;
      var4 = new BlockPortal.Shape(var1, var2, EnumDirection.EnumAxis.Z);
    }

    if (!var4.d()) {
      return new ShapeDetector.ShapeDetectorCollection(
          var2, EnumDirection.NORTH, EnumDirection.UP, var5, 1, 1, 1);
    } else {
      int[] var6 = new int[EnumDirection.EnumAxisDirection.values().length];
      EnumDirection var7 = var4.c.f();
      BlockPosition var8 = var4.f.up(var4.a() - 1);
      EnumDirection.EnumAxisDirection[] var9 = EnumDirection.EnumAxisDirection.values();
      int var10 = var9.length;

      int var11;
      for (var11 = 0; var11 < var10; ++var11) {
        EnumDirection.EnumAxisDirection var12 = var9[var11];
        ShapeDetector.ShapeDetectorCollection var13 =
            new ShapeDetector.ShapeDetectorCollection(
                var7.c() == var12 ? var8 : var8.shift(var4.c, var4.b() - 1),
                EnumDirection.a(var12, var3),
                EnumDirection.UP,
                var5,
                var4.b(),
                var4.a(),
                1);

        for (int var14 = 0; var14 < var4.b(); ++var14) {
          for (int var15 = 0; var15 < var4.a(); ++var15) {
            ShapeDetectorBlock var16 = var13.a(var14, var15, 1);
            if (var16.a() != null && var16.a().getBlock().getMaterial() != Material.AIR) {
              ++var6[var12.ordinal()];
            }
          }
        }
      }

      EnumDirection.EnumAxisDirection var17 = EnumDirection.EnumAxisDirection.POSITIVE;
      EnumDirection.EnumAxisDirection[] var18 = EnumDirection.EnumAxisDirection.values();
      var11 = var18.length;

      for (int var19 = 0; var19 < var11; ++var19) {
        EnumDirection.EnumAxisDirection var20 = var18[var19];
        if (var6[var20.ordinal()] < var6[var17.ordinal()]) {
          var17 = var20;
        }
      }

      return new ShapeDetector.ShapeDetectorCollection(
          var7.c() == var17 ? var8 : var8.shift(var4.c, var4.b() - 1),
          EnumDirection.a(var17, var3),
          EnumDirection.UP,
          var5,
          var4.b(),
          var4.a(),
          1);
    }
  }
Example #4
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);
        }
      }
    }
  }