private static void harvestCrops(IBlockState blockState, EntityPlayer player, World world, BlockPos blockPos) {
final BlockCrops crops = (BlockCrops) blockState.getBlock();
final ItemStack stack = player.getHeldItemMainhand();
final int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, stack);
final List<ItemStack> drops = crops.getDrops(world, blockPos, blockState, fortune);
final Item seedItem = crops.getItemDropped(blockState, world.rand, fortune);
if(seedItem != null)
for(Iterator<ItemStack> iterator = drops.iterator(); iterator.hasNext();) {
final ItemStack drop = iterator.next();
if(!(drop.getItem() == seedItem) || crops instanceof BlockCarrot || crops instanceof BlockPotato) {
iterator.remove();
break;
}
}
ForgeEventFactory.fireBlockHarvesting(drops, world, blockPos, blockState, fortune, 1f, false, player);
world.setBlockState(blockPos, crops.withAge(0));
for(ItemStack drop : drops) {
dropItem(drop, world, blockPos);
}
}