I want to prevent some crops from being placed on the farmland. The code below does this, but the crop appears on the farmland for a moment and then disappears immediately. The problem is that after that the crop does not drop on the ground. This means that someone in survival mode will completely lose their items while trying to put them in farmland. How can I make the item I tried to put in Farmland (and failed) drop on the ground after the process?
BlockEvents.rightClicked( event => {
if ((event.item.id == 'minecraft:potato' || event.item.id == 'minecraft:potato') && event.block.id == 'minecraft:farmland') event.cancel()
})```