How exactly are you representing "portions of" an item in your game?
The standard way to implement what you're doing is to just have multiples of the item. So, like, you say Sand is one grain of sand and you get 150 or something at a time. Then your synthesis might take 80 of them, so you still have 70 grains of sand left.
I don't know of any way (without using a plugin I haven't seen) to represent partial ownership of an item. You can't have 0.83 potions.
Do you not want the synthesis to consume the ingredient at all
, and it's just there as a threshold? You must own this item in order to perform these syntheses?
As far as I know, there's not a way to run a common event after a particular recipe is synthesized so that I can return the ingredient that way.
Of course you can, the instructions list the Custom Synthesis Effect notetag and say "you can use these notetags to make a custom effect that will occur when a specific item is synthesized."