コード例 #1
0
ファイル: BlockPortal.java プロジェクト: MineHQ/mc-dev-1.8.7
    protected int a(BlockPosition var1, EnumDirection var2) {
      int var3;
      for (var3 = 0; var3 < 22; ++var3) {
        BlockPosition var4 = var1.shift(var2, var3);
        if (!this.a(this.a.getType(var4).getBlock())
            || this.a.getType(var4.down()).getBlock() != Blocks.OBSIDIAN) {
          break;
        }
      }

      Block var5 = this.a.getType(var1.shift(var2, var3)).getBlock();
      return var5 == Blocks.OBSIDIAN ? var3 : 0;
    }
コード例 #2
0
ファイル: BlockPortal.java プロジェクト: MineHQ/mc-dev-1.8.7
    public Shape(World var1, BlockPosition var2, EnumDirection.EnumAxis var3) {
      this.a = var1;
      this.b = var3;
      if (var3 == EnumDirection.EnumAxis.X) {
        this.d = EnumDirection.EAST;
        this.c = EnumDirection.WEST;
      } else {
        this.d = EnumDirection.NORTH;
        this.c = EnumDirection.SOUTH;
      }

      for (BlockPosition var4 = var2;
          var2.getY() > var4.getY() - 21
              && var2.getY() > 0
              && this.a(var1.getType(var2.down()).getBlock());
          var2 = var2.down()) {;
      }

      int var5 = this.a(var2, this.d) - 1;
      if (var5 >= 0) {
        this.f = var2.shift(this.d, var5);
        this.h = this.a(this.f, this.c);
        if (this.h < 2 || this.h > 21) {
          this.f = null;
          this.h = 0;
        }
      }

      if (this.f != null) {
        this.g = this.c();
      }
    }
コード例 #3
0
ファイル: BlockPortal.java プロジェクト: MineHQ/mc-dev-1.8.7
    protected int c() {
      int var1;
      label56:
      for (this.g = 0; this.g < 21; ++this.g) {
        for (var1 = 0; var1 < this.h; ++var1) {
          BlockPosition var2 = this.f.shift(this.c, var1).up(this.g);
          Block var3 = this.a.getType(var2).getBlock();
          if (!this.a(var3)) {
            break label56;
          }

          if (var3 == Blocks.PORTAL) {
            ++this.e;
          }

          if (var1 == 0) {
            var3 = this.a.getType(var2.shift(this.d)).getBlock();
            if (var3 != Blocks.OBSIDIAN) {
              break label56;
            }
          } else if (var1 == this.h - 1) {
            var3 = this.a.getType(var2.shift(this.c)).getBlock();
            if (var3 != Blocks.OBSIDIAN) {
              break label56;
            }
          }
        }
      }

      for (var1 = 0; var1 < this.h; ++var1) {
        if (this.a.getType(this.f.shift(this.c, var1).up(this.g)).getBlock() != Blocks.OBSIDIAN) {
          this.g = 0;
          break;
        }
      }

      if (this.g <= 21 && this.g >= 3) {
        return this.g;
      } else {
        this.f = null;
        this.h = 0;
        this.g = 0;
        return 0;
      }
    }
コード例 #4
0
ファイル: ItemBed.java プロジェクト: MineHQ/mc-dev-1.8.7
  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;
      }
    }
  }
コード例 #5
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;
  }
コード例 #6
0
ファイル: ItemSign.java プロジェクト: MineHQ/mc-dev-1.8.7
  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;
      }
    }
  }
コード例 #7
0
ファイル: BlockPortal.java プロジェクト: MineHQ/mc-dev-1.8.7
  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);
    }
  }