예제 #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;
      }
    }
  }
예제 #2
0
    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
  public void b(World var1, BlockPosition var2, IBlockData var3, Random var4) {
    super.b(var1, var2, var3, var4);
    if (var1.worldProvider.d()
        && var1.getGameRules().getBoolean("doMobSpawning")
        && var4.nextInt(2000) < var1.getDifficulty().a()) {
      int var5 = var2.getY();

      BlockPosition var6;
      for (var6 = var2;
          !World.a((IBlockAccess) var1, (BlockPosition) var6) && var6.getY() > 0;
          var6 = var6.down()) {;
      }

      if (var5 > 0 && !var1.getType(var6.up()).getBlock().isOccluding()) {
        Entity var7 =
            ItemMonsterEgg.a(
                var1,
                57,
                (double) var6.getX() + 0.5D,
                (double) var6.getY() + 1.1D,
                (double) var6.getZ() + 0.5D);
        if (var7 != null) {
          var7.portalCooldown = var7.aq();
        }
      }
    }
  }
예제 #4
0
  public void b(World var1, BlockPosition var2, IBlockData var3, Random var4) {
    if (this.material == Material.LAVA) {
      if (var1.getGameRules().getBoolean("doFireTick")) {
        int var5 = var4.nextInt(3);
        if (var5 > 0) {
          BlockPosition var6 = var2;

          for (int var7 = 0; var7 < var5; ++var7) {
            var6 = var6.a(var4.nextInt(3) - 1, 1, var4.nextInt(3) - 1);
            Block var8 = var1.getType(var6).getBlock();
            if (var8.material == Material.AIR) {
              if (this.f(var1, var6)) {
                var1.setTypeUpdate(var6, Blocks.FIRE.getBlockData());
                return;
              }
            } else if (var8.material.isSolid()) {
              return;
            }
          }
        } else {
          for (int var9 = 0; var9 < 3; ++var9) {
            BlockPosition var10 = var2.a(var4.nextInt(3) - 1, 0, var4.nextInt(3) - 1);
            if (var1.isEmpty(var10.up()) && this.m(var1, var10)) {
              var1.setTypeUpdate(var10.up(), Blocks.FIRE.getBlockData());
            }
          }
        }
      }
    }
  }
예제 #5
0
 public boolean interact(
     World var1,
     BlockPosition var2,
     IBlockData var3,
     EntityHuman var4,
     EnumUsedHand var5,
     ItemStack var6,
     EnumDirection var7,
     float var8,
     float var9,
     float var10) {
   class_yu var11 = var4.cq();
   TileEntity var12 = var1.getTileEntity(var2);
   if (var11 != null && var12 instanceof TileEntityEnderChest) {
     if (var1.getType(var2.up()).getBlock().isOccluding()) {
       return true;
     } else if (var1.isClientSide) {
       return true;
     } else {
       var11.a((TileEntityEnderChest) var12);
       var4.openContainer((IInventory) var11);
       var4.b(StatisticList.V);
       return true;
     }
   } else {
     return true;
   }
 }
예제 #6
0
  protected static float a(Block var0, World var1, BlockPosition var2) {
    float var3 = 1.0F;
    BlockPosition var4 = var2.down();

    for (int var5 = -1; var5 <= 1; ++var5) {
      for (int var6 = -1; var6 <= 1; ++var6) {
        float var7 = 0.0F;
        IBlockData var8 = var1.getType(var4.a(var5, 0, var6));
        if (var8.getBlock() == Blocks.FARMLAND) {
          var7 = 1.0F;
          if (((Integer) var8.get(BlockSoil.MOISTURE)).intValue() > 0) {
            var7 = 3.0F;
          }
        }

        if (var5 != 0 || var6 != 0) {
          var7 /= 4.0F;
        }

        var3 += var7;
      }
    }

    BlockPosition var12 = var2.north();
    BlockPosition var13 = var2.south();
    BlockPosition var15 = var2.west();
    BlockPosition var14 = var2.east();
    boolean var9 = var0 == var1.getType(var15).getBlock() || var0 == var1.getType(var14).getBlock();
    boolean var10 =
        var0 == var1.getType(var12).getBlock() || var0 == var1.getType(var13).getBlock();
    if (var9 && var10) {
      var3 /= 2.0F;
    } else {
      boolean var11 =
          var0 == var1.getType(var15.north()).getBlock()
              || var0 == var1.getType(var14.north()).getBlock()
              || var0 == var1.getType(var14.south()).getBlock()
              || var0 == var1.getType(var15.south()).getBlock();
      if (var11) {
        var3 /= 2.0F;
      }
    }

    return var3;
  }
예제 #7
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;
      }
    }
  }
예제 #8
0
 private boolean m(World var1, BlockPosition var2) {
   return var1.getType(var2).getBlock().getMaterial().isBurnable();
 }
예제 #9
0
 public boolean canPlace(World var1, BlockPosition var2) {
   return var1.getType(var2).getBlock().material.isReplaceable()
       && World.a((IBlockAccess) var1, (BlockPosition) var2.down());
 }
예제 #10
0
 public boolean f(World var1, BlockPosition var2, IBlockData var3) {
   return (var1.k(var2) >= 8 || var1.i(var2)) && this.c(var1.getType(var2.down()).getBlock());
 }