I have a basic code for getting diamonds (with chance) when right clicking dirt. My goal is to increase the chance (sum or multiply) by the amount of diamonds i have in my inventory.
here is my current code
onEvent('block.right_click', event => {
let diamondcount = block.createEntity('minecraft:diamond')
if (event.block.id != 'minecraft:dirt' && event.item.id != Item.empty || Math.random() > 0.01 + event.diamondcount.getCount() ) return
event.block.set('dirt')
event.block.popItem('diamond')
})```


