code
ItemEvents.entityInteracted(event => { const { target, item, player, level, hand } = event; if (hand != 'MAIN_HAND') return; if (target.type === 'minecraft:cow' && item.id === 'minecraft:diamond') { if (!target.isBaby() && target.getLoveCause() == NULL) { if (!player.isCreative()) item.count--; target.setInLove(player); level.spawnParticles('heart', target.x, target.y + 1, target.z, 0.5, 0.5, 0.5, 5, 0.05); target.playSound('entity.cow.eat'); event.cancel(); } } });
for some reason this doesn't work. when I click the cows with the diamond, nothing happens. neoforge 1.21.1. Can someone please tell me what's wrong with the code? I'm not very good at it.
#Custom Breeding Items code not working
5 messages · Page 1 of 1 (latest)