Esempio n. 1
0
 public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {
   super.onPlace(world, blockposition, iblockdata);
   if (world.isBlockIndirectlyPowered(blockposition)) {
     this.postBreak(world, blockposition, iblockdata.set(BlockTNT.EXPLODE, Boolean.valueOf(true)));
     world.setAir(blockposition);
   }
 }
Esempio n. 2
0
  public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
    int i1 = l & 7;

    this.a(world, i, j, k, new ItemStack(Items.SNOW_BALL, i1 + 1, 0));
    world.setAir(i, j, k);
    entityhuman.a(StatisticList.C[Block.b((Block) this)], 1);
  }
Esempio n. 3
0
 @Override
 public void doPhysics(World world, int i, int j, int k, Block block) {
   if (world.isBlockIndirectlyPowered(i, j, k)) {
     postBreak(world, i, j, k, 1);
     world.setAir(i, j, k);
   }
 }
Esempio n. 4
0
 private boolean e(World world, BlockPosition blockposition, IBlockData iblockdata) {
   if (canPlace(world, blockposition)) {
     return true;
   }
   b(world, blockposition, iblockdata, 0);
   world.setAir(blockposition);
   return false;
 }
Esempio n. 5
0
 @Override
 public void onPlace(World world, int i, int j, int k) {
   super.onPlace(world, i, j, k);
   if (world.isBlockIndirectlyPowered(i, j, k)) {
     postBreak(world, i, j, k, 1);
     world.setAir(i, j, k);
   }
 }
  public void doPhysics(World var1, BlockPosition var2, IBlockData var3, Block var4) {
    EnumDirection var5 = (EnumDirection) var3.get(a);
    if (!var1.getType(var2.shift(var5.opposite())).getBlock().getMaterial().isBuildable()) {
      this.dropNaturallyForSure(var1, var2, var3, 0);
      var1.setAir(var2);
    }

    super.doPhysics(var1, var2, var3, var4);
  }
Esempio n. 7
0
 private boolean m(World world, int i, int j, int k) {
   if (!this.canPlace(world, i, j, k)) {
     this.b(world, i, j, k, world.getData(i, j, k), 0);
     world.setAir(i, j, k);
     return false;
   } else {
     return true;
   }
 }
Esempio n. 8
0
 public void doPhysics(
     World world, BlockPosition blockposition, IBlockData iblockdata, Block block) {
   if ((e(world, blockposition, iblockdata))
       && (!a(
           world, blockposition, ((EnumLeverPosition) iblockdata.get(FACING)).c().opposite()))) {
     b(world, blockposition, iblockdata, 0);
     world.setAir(blockposition);
   }
 }
  public void doPhysics(World world, int i, int j, int k, int l) {
    int i1 = world.getData(i, j, k);
    boolean flag = (i1 & 2) == 2;
    boolean flag1 = !world.w(i, j - 1, k);

    if (flag != flag1) {
      this.c(world, i, j, k, i1, 0);
      world.setAir(i, j, k);
    }
  }
Esempio n. 10
0
  public void doPhysics(World world, int i, int j, int k, int l) {
    byte b0 = 0;
    byte b1 = 1;

    if (world.getTypeId(i - 1, j, k) == this.id || world.getTypeId(i + 1, j, k) == this.id) {
      b0 = 1;
      b1 = 0;
    }

    int i1;

    for (i1 = j; world.getTypeId(i, i1 - 1, k) == this.id; --i1) {;
    }

    if (world.getTypeId(i, i1 - 1, k) != Block.OBSIDIAN.id) {
      world.setAir(i, j, k);
    } else {
      int j1;

      for (j1 = 1; j1 < 4 && world.getTypeId(i, i1 + j1, k) == this.id; ++j1) {;
      }

      if (j1 == 3 && world.getTypeId(i, i1 + j1, k) == Block.OBSIDIAN.id) {
        boolean flag =
            world.getTypeId(i - 1, j, k) == this.id || world.getTypeId(i + 1, j, k) == this.id;
        boolean flag1 =
            world.getTypeId(i, j, k - 1) == this.id || world.getTypeId(i, j, k + 1) == this.id;

        if (flag && flag1) {
          world.setAir(i, j, k);
        } else {
          if ((world.getTypeId(i + b0, j, k + b1) != Block.OBSIDIAN.id
                  || world.getTypeId(i - b0, j, k - b1) != this.id)
              && (world.getTypeId(i - b0, j, k - b1) != Block.OBSIDIAN.id
                  || world.getTypeId(i + b0, j, k + b1) != this.id)) {
            world.setAir(i, j, k);
          }
        }
      } else {
        world.setAir(i, j, k);
      }
    }
  }
Esempio n. 11
0
 public void a(
     IBlockData iblockdata,
     World world,
     BlockPosition blockposition,
     Block block,
     BlockPosition blockposition1) {
   if (world.isBlockIndirectlyPowered(blockposition)) {
     this.postBreak(world, blockposition, iblockdata.set(BlockTNT.EXPLODE, Boolean.valueOf(true)));
     world.setAir(blockposition);
   }
 }
Esempio n. 12
0
  public void a(World world, int i, int j, int k, Random random) {
    if (world.b(EnumSkyBlock.BLOCK, i, j, k) > 11) {
      // CraftBukkit start
      if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(
              world.getWorld().getBlockAt(i, j, k), Blocks.AIR)
          .isCancelled()) {
        return;
      }
      // CraftBukkit end

      this.b(world, i, j, k, world.getData(i, j, k), 0);
      world.setAir(i, j, k);
    }
  }
Esempio n. 13
0
 @Override
 public boolean interact(
     World world,
     int i,
     int j,
     int k,
     EntityHuman entityhuman,
     int l,
     float f,
     float f1,
     float f2) {
   if (entityhuman.bF() != null && entityhuman.bF().getItem() == Items.FLINT_AND_STEEL) {
     this.a(world, i, j, k, 1, (EntityLiving) entityhuman); // Spigot - Fix decompile error!
     world.setAir(i, j, k);
     entityhuman.bF().damage(1, entityhuman);
     return true;
   } else return super.interact(world, i, j, k, entityhuman, l, f, f1, f2);
 }
Esempio n. 14
0
  public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
    if (!world.isClientSide && entity instanceof EntityArrow) {
      EntityArrow entityarrow = (EntityArrow) entity;

      if (entityarrow.isBurning()) {
        // CraftBukkit start
        if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(
                entityarrow, blockposition, Blocks.AIR, 0)
            .isCancelled()) {
          return;
        }
        // CraftBukkit end
        this.a(
            world,
            blockposition,
            world.getType(blockposition).set(BlockTNT.EXPLODE, Boolean.valueOf(true)),
            entityarrow.shooter instanceof EntityLiving
                ? (EntityLiving) entityarrow.shooter
                : null);
        world.setAir(blockposition);
      }
    }
  }
Esempio n. 15
0
  @Override
  public void a(World world, int i, int j, int k, Entity entity) {
    if (entity instanceof EntityArrow && !world.isStatic) {
      EntityArrow entityarrow = (EntityArrow) entity;

      if (entityarrow.isBurning()) {
        // CraftBukkit start
        if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(
                entityarrow, i, j, k, Blocks.AIR, 0)
            .isCancelled()) return;
        // CraftBukkit end
        this.a(
            world,
            i,
            j,
            k,
            1,
            entityarrow.shooter instanceof EntityLiving
                ? (EntityLiving) entityarrow.shooter
                : null);
        world.setAir(i, j, k);
      }
    }
  }
Esempio n. 16
0
  public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
    org.bukkit.World bworld = world.getWorld();
    Server server = world.getServer();
    org.bukkit.block.Block source =
        bworld == null
            ? null
            : bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());

    int i = ((Integer) iblockdata.get(LEVEL)).intValue();
    byte b0 = 1;
    if ((this.material == Material.LAVA) && (!world.worldProvider.n())) {
      b0 = 2;
    }
    int j = a(world);
    if (i > 0) {
      int l = -100;

      this.a = 0;
      EnumDirection enumdirection;
      for (Iterator iterator = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator();
          iterator.hasNext();
          l = a(world, blockposition.shift(enumdirection), l)) {
        enumdirection = (EnumDirection) iterator.next();
      }
      int i1 = l + b0;
      if ((i1 >= 8) || (l < 0)) {
        i1 = -1;
      }
      if (e(world, blockposition.up()) >= 0) {
        int k = e(world, blockposition.up());
        if (k >= 8) {
          i1 = k;
        } else {
          i1 = k + 8;
        }
      }
      if ((this.a >= 2) && (this.material == Material.WATER)) {
        IBlockData iblockdata1 = world.getType(blockposition.down());
        if (iblockdata1.getBlock().getMaterial().isBuildable()) {
          i1 = 0;
        } else if ((iblockdata1.getBlock().getMaterial() == this.material)
            && (((Integer) iblockdata1.get(LEVEL)).intValue() == 0)) {
          i1 = 0;
        }
      }
      if ((this.material == Material.LAVA)
          && (i < 8)
          && (i1 < 8)
          && (i1 > i)
          && (random.nextInt(4) != 0)) {
        j *= 4;
      }
      if (i1 == i) {
        f(world, blockposition, iblockdata);
      } else {
        i = i1;
        if (i1 < 0) {
          world.setAir(blockposition);
        } else {
          iblockdata = iblockdata.set(LEVEL, Integer.valueOf(i1));
          world.setTypeAndData(blockposition, iblockdata, 2);
          world.a(blockposition, this, j);
          world.applyPhysics(blockposition, this);
        }
      }
    } else {
      f(world, blockposition, iblockdata);
    }
    IBlockData iblockdata2 = world.getType(blockposition.down());
    if (h(world, blockposition.down(), iblockdata2)) {
      BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN);
      if (server != null) {
        server.getPluginManager().callEvent(event);
      }
      if (!event.isCancelled()) {
        if ((this.material == Material.LAVA)
            && (world.getType(blockposition.down()).getBlock().getMaterial() == Material.WATER)) {
          world.setTypeUpdate(blockposition.down(), Blocks.STONE.getBlockData());
          fizz(world, blockposition.down());
          return;
        }
        if (i >= 8) {
          flow(world, blockposition.down(), iblockdata2, i);
        } else {
          flow(world, blockposition.down(), iblockdata2, i + 8);
        }
      }
    } else if ((i >= 0) && ((i == 0) || (g(world, blockposition.down(), iblockdata2)))) {
      Set set = f(world, blockposition);

      int k = i + b0;
      if (i >= 8) {
        k = 1;
      }
      if (k >= 8) {
        return;
      }
      Iterator iterator1 = set.iterator();
      while (iterator1.hasNext()) {
        EnumDirection enumdirection1 = (EnumDirection) iterator1.next();

        BlockFromToEvent event =
            new BlockFromToEvent(source, CraftBlock.notchToBlockFace(enumdirection1));
        if (server != null) {
          server.getPluginManager().callEvent(event);
        }
        if (!event.isCancelled()) {
          flow(
              world,
              blockposition.shift(enumdirection1),
              world.getType(blockposition.shift(enumdirection1)),
              k);
        }
      }
    }
  }
  public UseResult interactWith(
      ItemStack var1,
      EntityHuman var2,
      World var3,
      BlockPosition var4,
      EnumUsedHand var5,
      EnumDirection var6,
      float var7,
      float var8,
      float var9) {
    if (var6 == EnumDirection.DOWN) {
      return UseResult.CANT_USE;
    } else {
      boolean var10 = var3.getType(var4).getBlock().isReplaceable(var3, var4);
      BlockPosition var11 = var10 ? var4 : var4.shift(var6);
      if (!var2.a(var11, var6, var1)) {
        return UseResult.CANT_USE;
      } else {
        BlockPosition var12 = var11.up();
        boolean var13 =
            !var3.isEmpty(var11) && !var3.getType(var11).getBlock().isReplaceable(var3, var11);
        var13 |= !var3.isEmpty(var12) && !var3.getType(var12).getBlock().isReplaceable(var3, var12);
        if (var13) {
          return UseResult.CANT_USE;
        } else {
          double var14 = (double) var11.getX();
          double var16 = (double) var11.getY();
          double var18 = (double) var11.getZ();
          List var20 =
              var3.getEntities(
                  (Entity) null,
                  (AxisAlignedBB)
                      AxisAlignedBB.a(
                          var14, var16, var18, var14 + 1.0D, var16 + 2.0D, var18 + 1.0D));
          if (!var20.isEmpty()) {
            return UseResult.CANT_USE;
          } else {
            if (!var3.isClientSide) {
              var3.setAir(var11);
              var3.setAir(var12);
              EntityArmorStand var21 =
                  new EntityArmorStand(var3, var14 + 0.5D, var16, var18 + 0.5D);
              float var22 =
                  (float)
                          MathHelper.floor(
                              (MathHelper.clampAngle(var2.yaw - 180.0F) + 22.5F) / 45.0F)
                      * 45.0F;
              var21.setPositionRotation(var14 + 0.5D, var16, var18 + 0.5D, var22, 0.0F);
              this.a(var21, var3.random);
              NBTTagCompound var23 = var1.getTag();
              if (var23 != null && var23.hasOfType("EntityTag", 10)) {
                NBTTagCompound var24 = new NBTTagCompound();
                var21.d(var24);
                var24.copyFrom(var23.getCompound("EntityTag"));
                var21.f(var24);
              }

              var3.addEntity((Entity) var21);
            }

            --var1.count;
            return UseResult.SUCCESS;
          }
        }
      }
    }
  }