public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
if (!worldIn.isRemote && !worldIn.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe
{
java.util.List<ItemStack> items = getDrops(worldIn, pos, state, fortune);
chance = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, fortune, chance, false, harvesters.get());
for (ItemStack item : items)
{
if (worldIn.rand.nextFloat() <= chance)
{
spawnAsEntity(worldIn, pos, item);
}
}
}
}