package net.minecraft.block;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockOre extends Block
{
private static final String __OBFID = "CL_00000282";
public BlockOre()
{
super(Material.rock);
this.setCreativeTab(CreativeTabs.tabBlock);
}
public Item getItemDropped(int meta, Random random, int fortune)
{
return this == Blocks.coal_ore ? Items.coal : (this == Blocks.diamond_ore ? Items.diamond : (this == Blocks.lapis_ore ? Items.dye : (this == Blocks.emerald_ore ? Items.emerald : (this == Blocks.quartz_ore ? Items.quartz : Item.getItemFromBlock(this)))));
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random random)
{
return this == Blocks.lapis_ore ? 4 + random.nextInt(5) : 1;
}
/**
* Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' (inclusive).
*/
public int quantityDroppedWithBonus(int maxBonus, Random random)
{
if (maxBonus > 0 && Item.getItemFromBlock(this) != this.getItemDropped(0, random, maxBonus))
{
int j = random.nextInt(maxBonus + 2) - 1;
if (j < 0)
{
j = 0;
}
return this.quantityDropped(random) * (j + 1);
}
else
{
return this.quantityDropped(random);
}
}
/**
* Drops the block items with a specified chance of dropping the specified items
*/
public void dropBlockAsItemWithChance(World worldIn, int x, int y, int z, int meta, float chance, int fortune)
{
super.dropBlockAsItemWithChance(worldIn, x, y, z, meta, chance, fortune);
}
private Random rand = new Random();
@Override
public int getExpDrop(IBlockAccess worldIn, int meta, int fortune)
{
if (this.getItemDropped(meta, rand, fortune) != Item.getItemFromBlock(this))
{
int j1 = 0;
if (this == Blocks.coal_ore)
{
j1 = MathHelper.getRandomIntegerInRange(rand, 0, 2);
}
else if (this == Blocks.diamond_ore)
{
j1 = MathHelper.getRandomIntegerInRange(rand, 3, 7);
}
else if (this == Blocks.emerald_ore)
{
j1 = MathHelper.getRandomIntegerInRange(rand, 3, 7);
}
else if (this == Blocks.lapis_ore)
{
j1 = MathHelper.getRandomIntegerInRange(rand, 2, 5);
}
else if (this == Blocks.quartz_ore)
{
j1 = MathHelper.getRandomIntegerInRange(rand, 2, 5);
}
return j1;
}
return 0;
}
/**
* Determines the damage on the item the block drops. Used in cloth and wood.
*/
public int damageDropped(int meta)
{
return this == Blocks.lapis_ore ? 4 : 0;
}
}