Using a datapack, I've added a diet system to the game. Consuming foods of different groups is intended to give a set number of points to each respective group. For example, the golden carrot is intended to give 6 points to the vegetables score (which it does.) The potato is intended to give 1 point to the score (which it also does.) But for some reason, the carrot behaves completely differently. It is intended to give 3 points, but gives more, and gives points when clicking a block, as shown in the video. The setup is identical for all three items, and I scoured the code for instances where perhaps something else was adding to the score, but I can't find anything.
Carrot consumption is detected with an advancement carrot.json:
{
"criteria": {
"consume": {
"trigger": "minecraft:consume_item",
"conditions": {
"item": {
"items": ["carrot"]
}
}
}
},
"rewards": {
"function": "mastermode:eat/carrot"
}
}
This advancement is interchangeable with the golden carrot/potato advancement, barring you'd have to change instances of "carrot" with "golden_carrot" or "potato".
As a reward, this advancement runs the following function, carrot.mcfunction, that adds 3 points to the vegetables score and clears the advancement so another carrot may be eaten.
advancement revoke only mastermode:consumed/carrot
scoreboard players add @s vegetables 3
# For testing purposes:
say carrot.mcfunction ran
Again, I've used Ctrl+Shift+F in VS Code to look for instances of "scoreboard players add u/s vegetables 1", or "carrot", or "vegetables", and I've found nothing. I cannot for the life of me explain why the carrot specifically is working like this. I've tested like a dozen other food items and none of them have this problem. Any ideas/solutions would be appreciated.