public class BlockOreHook
{
private static Random rand = new Random();
@Hook(createMethod = true, returnCondition = ReturnCondition.ALWAYS)
public static int quantityDroppedWithBonus(BlockOre blockOre, int fortuneLevel, Random rand)
{
if (fortuneLevel > 0)
{
if(blockOre == Blocks.coal_ore || blockOre == Blocks.diamond_ore || blockOre == Blocks.emerald_ore || blockOre == Blocks.lapis_ore || blockOre == Blocks.quartz_ore || blockOre == Blocks.redstone_ore)
{
ModSyntheticMethods.setNoExpDrop(blockOre, true);
}
if(Item.getItemFromBlock(blockOre) != blockOre.getItemDropped(0, rand, fortuneLevel))
{
int j = rand.nextInt(fortuneLevel + 2) - 1;
if (j < 0)
{
j = 0;
}
return blockOre.quantityDropped(rand) * (j + 1);
}
else
{
return blockOre.quantityDropped(rand);
}
}
else
{
return blockOre.quantityDropped(rand);
}
}
@Hook(createMethod = true, returnCondition = ReturnCondition.ALWAYS)
public static int getExpDrop(BlockOre blockOre, IBlockAccess blockAccess, int p_149690_5_, int p_149690_7_)
{
if (blockOre.getItemDropped(p_149690_5_, rand, p_149690_7_) != Item.getItemFromBlock(blockOre) && !ModSyntheticMethods.getNoExpDrop(blockOre))
{
int j1 = 0;
if (blockOre == Blocks.coal_ore)
{
j1 = MathHelper.getRandomIntegerInRange(rand, 0, 2);
}
else if (blockOre == Blocks.diamond_ore)
{
j1 = MathHelper.getRandomIntegerInRange(rand, 3, 7);
}
else if (blockOre == Blocks.emerald_ore)
{
j1 = MathHelper.getRandomIntegerInRange(rand, 3, 7);
}
else if (blockOre == Blocks.lapis_ore)
{
j1 = MathHelper.getRandomIntegerInRange(rand, 2, 5);
}
else if (blockOre == Blocks.quartz_ore)
{
j1 = MathHelper.getRandomIntegerInRange(rand, 2, 5);
}
return j1;
}
return 0;
}
}