Exemplo n.º 1
0
  public boolean interactWith(
      ItemStack var1,
      EntityHuman var2,
      World var3,
      BlockPosition var4,
      EnumDirection var5,
      float var6,
      float var7,
      float var8) {
    if (var3.isClientSide) {
      return true;
    } else if (var5 != EnumDirection.UP) {
      return false;
    } else {
      IBlockData var9 = var3.getType(var4);
      Block var10 = var9.getBlock();
      boolean var11 = var10.a(var3, var4);
      if (!var11) {
        var4 = var4.up();
      }

      int var12 = MathHelper.floor((double) (var2.yaw * 4.0F / 360.0F) + 0.5D) & 3;
      EnumDirection var13 = EnumDirection.fromType2(var12);
      BlockPosition var14 = var4.shift(var13);
      if (var2.a(var4, var5, var1) && var2.a(var14, var5, var1)) {
        boolean var15 = var3.getType(var14).getBlock().a(var3, var14);
        boolean var16 = var11 || var3.isEmpty(var4);
        boolean var17 = var15 || var3.isEmpty(var14);
        if (var16
            && var17
            && World.a((IBlockAccess) var3, (BlockPosition) var4.down())
            && World.a((IBlockAccess) var3, (BlockPosition) var14.down())) {
          IBlockData var18 =
              Blocks.BED
                  .getBlockData()
                  .set(BlockBed.OCCUPIED, Boolean.valueOf(false))
                  .set(BlockBed.FACING, var13)
                  .set(BlockBed.PART, BlockBed.EnumBedPart.FOOT);
          if (var3.setTypeAndData(var4, var18, 3)) {
            IBlockData var19 = var18.set(BlockBed.PART, BlockBed.EnumBedPart.HEAD);
            var3.setTypeAndData(var14, var19, 3);
          }

          --var1.count;
          return true;
        } else {
          return false;
        }
      } else {
        return false;
      }
    }
  }
Exemplo n.º 2
0
  public void g(World var1, BlockPosition var2, IBlockData var3) {
    int var4 = ((Integer) var3.get(AGE)).intValue() + MathHelper.nextInt(var1.random, 2, 5);
    if (var4 > 7) {
      var4 = 7;
    }

    var1.setTypeAndData(var2, var3.set(AGE, Integer.valueOf(var4)), 2);
  }
Exemplo n.º 3
0
  public boolean interactWith(
      ItemStack var1,
      EntityHuman var2,
      World var3,
      BlockPosition var4,
      EnumDirection var5,
      float var6,
      float var7,
      float var8) {
    if (var5 == EnumDirection.DOWN) {
      return false;
    } else if (!var3.getType(var4).getBlock().getMaterial().isBuildable()) {
      return false;
    } else {
      var4 = var4.shift(var5);
      if (!var2.a(var4, var5, var1)) {
        return false;
      } else if (!Blocks.STANDING_SIGN.canPlace(var3, var4)) {
        return false;
      } else if (var3.isClientSide) {
        return true;
      } else {
        if (var5 == EnumDirection.UP) {
          int var9 = MathHelper.floor((double) ((var2.yaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
          var3.setTypeAndData(
              var4,
              Blocks.STANDING_SIGN
                  .getBlockData()
                  .set(BlockFloorSign.ROTATION, Integer.valueOf(var9)),
              3);
        } else {
          var3.setTypeAndData(
              var4, Blocks.WALL_SIGN.getBlockData().set(BlockWallSign.FACING, var5), 3);
        }

        --var1.count;
        TileEntity var10 = var3.getTileEntity(var4);
        if (var10 instanceof TileEntitySign && !ItemBlock.a(var3, var2, var4, var1)) {
          var2.openSign((TileEntitySign) var10);
        }

        return true;
      }
    }
  }
Exemplo n.º 4
0
 public void b(World var1, BlockPosition var2, IBlockData var3, Random var4) {
   super.b(var1, var2, var3, var4);
   if (var1.getLightLevel(var2.up()) >= 9) {
     int var5 = ((Integer) var3.get(AGE)).intValue();
     if (var5 < 7) {
       float var6 = a(this, var1, var2);
       if (var4.nextInt((int) (25.0F / var6) + 1) == 0) {
         var1.setTypeAndData(var2, var3.set(AGE, Integer.valueOf(var5 + 1)), 2);
       }
     }
   }
 }
Exemplo n.º 5
0
 private void f(World var1, BlockPosition var2, IBlockData var3) {
   BlockFlowing var4 = a(this.material);
   var1.setTypeAndData(var2, var4.getBlockData().set(LEVEL, var3.get(LEVEL)), 2);
   var1.a((BlockPosition) var2, (Block) var4, this.a(var1));
 }
Exemplo n.º 6
0
 public void postPlace(
     World var1, BlockPosition var2, IBlockData var3, EntityLiving var4, ItemStack var5) {
   var1.setTypeAndData((BlockPosition) var2, (IBlockData) var3.set(a, var4.aR().opposite()), 2);
 }
Exemplo n.º 7
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);
        }
      }
    }
  }