I am trying to make a custom food recipe. I'm using spawn eggs with /replaceitem because spawn eggs are not obtainable in survival. This works fine when the player crafts only one spawn egg, but when I scroll over multiple spawn eggs, I receive only 1 of the custom food. BTW this food uses custommodeldata, so I can't simply add it into the crafting recipe. I cannot seem to find a way around this. If I make the item non-stackable, such as a piece of armor, mass crafting would be impossible. If I make an item.dropped scoreboard, the player could keep the item and use it to spawn mobs (griefing or for own profit.)
My command:
execute as @a[nbt={SelectedItem:{id:"minecraft:villager_spawn_egg"}}]
run replaceitem entity @s weapon
minecraft:melon_slice{CustomModelData:10000101,display:{
Name:"{\"text\":\"Blue Melon Slice\",\"italic\":\"false\"}"}}
My problem is that the command does not see item count, as it is often used for weapons and armor only.
One way I thought to fix this issue is by storing the amount of custom food crafted in a scoreboard item and then giving the player that same count of the custom food, but I do not know how to do this; consequently, I don't know if this works.
Is there a way to do this method, or is there another, simpler method possible?