Ejemplo n.º 1
0
  /** ejects contained items into the world, and notifies neighbours of an update, as appropriate */
  public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) {
    if (!par1World.isRemote) {
      if ((par6 & 8) == 0) {
        ItemStack var7 =
            new ItemStack(
                Item.skull.shiftedIndex, 1, this.getDamageValue(par1World, par2, par3, par4));
        TileEntitySkull var8 = (TileEntitySkull) par1World.getBlockTileEntity(par2, par3, par4);

        if (var8.func_82117_a() == 3
            && var8.func_82120_c() != null
            && var8.func_82120_c().length() > 0) {
          var7.setTagCompound(new NBTTagCompound());
          var7.getTagCompound().setString("SkullOwner", var8.func_82120_c());
        }

        this.dropBlockAsItem_do(par1World, par2, par3, par4, var7);
      }

      super.breakBlock(par1World, par2, par3, par4, par5, par6);
    }
  }
Ejemplo n.º 2
0
  /** This method attempts to create a wither at the given location and skull */
  public void makeWither(
      World par1World, int par2, int par3, int par4, TileEntitySkull par5TileEntitySkull) {
    if (par5TileEntitySkull.func_82117_a() == 1 && par3 >= 2 && par1World.difficultySetting > 0) {
      int var6 = Block.slowSand.blockID;
      int var7;
      EntityWither var8;
      int var9;

      for (var7 = -2; var7 <= 0; ++var7) {
        if (par1World.getBlockId(par2, par3 - 1, par4 + var7) == var6
            && par1World.getBlockId(par2, par3 - 1, par4 + var7 + 1) == var6
            && par1World.getBlockId(par2, par3 - 2, par4 + var7 + 1) == var6
            && par1World.getBlockId(par2, par3 - 1, par4 + var7 + 2) == var6
            && this.func_82528_d(par1World, par2, par3, par4 + var7, 1)
            && this.func_82528_d(par1World, par2, par3, par4 + var7 + 1, 1)
            && this.func_82528_d(par1World, par2, par3, par4 + var7 + 2, 1)) {
          par1World.setBlockMetadata(par2, par3, par4 + var7, 8);
          par1World.setBlockMetadata(par2, par3, par4 + var7 + 1, 8);
          par1World.setBlockMetadata(par2, par3, par4 + var7 + 2, 8);
          par1World.setBlock(par2, par3, par4 + var7, 0);
          par1World.setBlock(par2, par3, par4 + var7 + 1, 0);
          par1World.setBlock(par2, par3, par4 + var7 + 2, 0);
          par1World.setBlock(par2, par3 - 1, par4 + var7, 0);
          par1World.setBlock(par2, par3 - 1, par4 + var7 + 1, 0);
          par1World.setBlock(par2, par3 - 1, par4 + var7 + 2, 0);
          par1World.setBlock(par2, par3 - 2, par4 + var7 + 1, 0);

          if (!par1World.isRemote) {
            var8 = new EntityWither(par1World);
            var8.setLocationAndAngles(
                (double) par2 + 0.5D,
                (double) par3 - 1.45D,
                (double) (par4 + var7) + 1.5D,
                90.0F,
                0.0F);
            var8.renderYawOffset = 90.0F;
            var8.func_82206_m();
            par1World.spawnEntityInWorld(var8);
          }

          for (var9 = 0; var9 < 120; ++var9) {
            par1World.spawnParticle(
                "snowballpoof",
                (double) par2 + par1World.rand.nextDouble(),
                (double) (par3 - 2) + par1World.rand.nextDouble() * 3.9D,
                (double) (par4 + var7 + 1) + par1World.rand.nextDouble(),
                0.0D,
                0.0D,
                0.0D);
          }

          par1World.notifyBlockChange(par2, par3, par4 + var7, 0);
          par1World.notifyBlockChange(par2, par3, par4 + var7 + 1, 0);
          par1World.notifyBlockChange(par2, par3, par4 + var7 + 2, 0);
          par1World.notifyBlockChange(par2, par3 - 1, par4 + var7, 0);
          par1World.notifyBlockChange(par2, par3 - 1, par4 + var7 + 1, 0);
          par1World.notifyBlockChange(par2, par3 - 1, par4 + var7 + 2, 0);
          par1World.notifyBlockChange(par2, par3 - 2, par4 + var7 + 1, 0);
          return;
        }
      }

      for (var7 = -2; var7 <= 0; ++var7) {
        if (par1World.getBlockId(par2 + var7, par3 - 1, par4) == var6
            && par1World.getBlockId(par2 + var7 + 1, par3 - 1, par4) == var6
            && par1World.getBlockId(par2 + var7 + 1, par3 - 2, par4) == var6
            && par1World.getBlockId(par2 + var7 + 2, par3 - 1, par4) == var6
            && this.func_82528_d(par1World, par2 + var7, par3, par4, 1)
            && this.func_82528_d(par1World, par2 + var7 + 1, par3, par4, 1)
            && this.func_82528_d(par1World, par2 + var7 + 2, par3, par4, 1)) {
          par1World.setBlockMetadata(par2 + var7, par3, par4, 8);
          par1World.setBlockMetadata(par2 + var7 + 1, par3, par4, 8);
          par1World.setBlockMetadata(par2 + var7 + 2, par3, par4, 8);
          par1World.setBlock(par2 + var7, par3, par4, 0);
          par1World.setBlock(par2 + var7 + 1, par3, par4, 0);
          par1World.setBlock(par2 + var7 + 2, par3, par4, 0);
          par1World.setBlock(par2 + var7, par3 - 1, par4, 0);
          par1World.setBlock(par2 + var7 + 1, par3 - 1, par4, 0);
          par1World.setBlock(par2 + var7 + 2, par3 - 1, par4, 0);
          par1World.setBlock(par2 + var7 + 1, par3 - 2, par4, 0);

          if (!par1World.isRemote) {
            var8 = new EntityWither(par1World);
            var8.setLocationAndAngles(
                (double) (par2 + var7) + 1.5D,
                (double) par3 - 1.45D,
                (double) par4 + 0.5D,
                0.0F,
                0.0F);
            var8.func_82206_m();
            par1World.spawnEntityInWorld(var8);
          }

          for (var9 = 0; var9 < 120; ++var9) {
            par1World.spawnParticle(
                "snowballpoof",
                (double) (par2 + var7 + 1) + par1World.rand.nextDouble(),
                (double) (par3 - 2) + par1World.rand.nextDouble() * 3.9D,
                (double) par4 + par1World.rand.nextDouble(),
                0.0D,
                0.0D,
                0.0D);
          }

          par1World.notifyBlockChange(par2 + var7, par3, par4, 0);
          par1World.notifyBlockChange(par2 + var7 + 1, par3, par4, 0);
          par1World.notifyBlockChange(par2 + var7 + 2, par3, par4, 0);
          par1World.notifyBlockChange(par2 + var7, par3 - 1, par4, 0);
          par1World.notifyBlockChange(par2 + var7 + 1, par3 - 1, par4, 0);
          par1World.notifyBlockChange(par2 + var7 + 2, par3 - 1, par4, 0);
          par1World.notifyBlockChange(par2 + var7 + 1, par3 - 2, par4, 0);
          return;
        }
      }
    }
  }