    001    package net.minecraft.src;
    002
    003    import java.util.Random;
    004
    005    public class BlockOre extends Block
    006    {
    007        public BlockOre(int par1, int par2)
    008        {
    009            super(par1, par2, Material.rock);
    010            this.setCreativeTab(CreativeTabs.tabBlock);
    011        }
    012
    013        /**
    014         * Returns the ID of the items to drop on destruction.
    015         */
    016        public int idDropped(int par1, Random par2Random, int par3)
    017        {
    018            return this.blockID == Block.oreCoal.blockID ? Item.coal.shiftedIndex : (this.blockID == Block.oreDiamond.blockID ? Item.diamond.shiftedIndex : (this.blockID == Block.oreLapis.blockID ? Item.dyePowder.shiftedIndex : (this.blockID == Block.oreEmerald.blockID ? Item.emerald.shiftedIndex : this.blockID)));
    019        }
    020
    021        /**
    022         * Returns the quantity of items to drop on block destruction.
    023         */
    024        public int quantityDropped(Random par1Random)
    025        {
    026            return this.blockID == Block.oreLapis.blockID ? 4 + par1Random.nextInt(5) : 1;
    027        }
    028
    029        /**
    030         * Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' (inclusive).
    031         */
    032        public int quantityDroppedWithBonus(int par1, Random par2Random)
    033        {
    034            if (par1 > 0 && this.blockID != this.idDropped(0, par2Random, par1))
    035            {
    036                int var3 = par2Random.nextInt(par1 + 2) - 1;
    037
    038                if (var3 < 0)
    039                {
    040                    var3 = 0;
    041                }
    042
    043                return this.quantityDropped(par2Random) * (var3 + 1);
    044            }
    045            else
    046            {
    047                return this.quantityDropped(par2Random);
    048            }
    049        }
    050
    051        /**
    052         * Drops the block items with a specified chance of dropping the specified items
    053         */
    054        public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
    055        {
    056            super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7);
    057
    058            if (this.idDropped(par5, par1World.rand, par7) != this.blockID)
    059            {
    060                int var8 = 0;
    061
    062                if (this.blockID == Block.oreCoal.blockID)
    063                {
    064                    var8 = MathHelper.getRandomIntegerInRange(par1World.rand, 0, 2);
    065                }
    066                else if (this.blockID == Block.oreDiamond.blockID)
    067                {
    068                    var8 = MathHelper.getRandomIntegerInRange(par1World.rand, 3, 7);
    069                }
    070                else if (this.blockID == Block.oreEmerald.blockID)
    071                {
    072                    var8 = MathHelper.getRandomIntegerInRange(par1World.rand, 3, 7);
    073                }
    074                else if (this.blockID == Block.oreLapis.blockID)
    075                {
    076                    var8 = MathHelper.getRandomIntegerInRange(par1World.rand, 2, 5);
    077                }
    078
    079                this.dropXpOnBlockBreak(par1World, par2, par3, par4, var8);
    080            }
    081        }
    082
    083        /**
    084         * Determines the damage on the item the block drops. Used in cloth and wood.
    085         */
    086        public int damageDropped(int par1)
    087        {
    088            return this.blockID == Block.oreLapis.blockID ? 4 : 0;
    089        }
    090    }