public IBlockData fromLegacyData(int var1) {
    EnumDirection var2 = EnumDirection.getById(var1);
    if (var2.getAxis() == EnumDirection.EnumAxis.Y) {
      var2 = EnumDirection.NORTH;
    }

    return this.getBlockData().set(a, var2);
  }
示例#2
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;
      }
    }
  }
示例#3
0
  protected boolean f(World var1, BlockPosition var2) {
    EnumDirection[] var3 = EnumDirection.values();
    int var4 = var3.length;

    for (int var5 = 0; var5 < var4; ++var5) {
      EnumDirection var6 = var3[var5];
      if (this.m(var1, var2.shift(var6))) {
        return true;
      }
    }

    return false;
  }
示例#4
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);
    }
  }
示例#5
0
 public IBlockData fromLegacyData(int var1) {
   return this.getBlockData().set(FACING, EnumDirection.fromType2(var1));
 }