If you modify a PrepareAnvilEvent, you can currently specify a new result for the given input and modify the state of the AnvilInventory.
But if you want to add a recipe, which uses a stack with size > 1 in the sacrifice slot (like f.ex. a new repair recipe), the recipe will simply remove the entire stack when taking out the result.
I have searched multiple Forums for a more elegant solution (more elegant than stressing the server with an additional item stack being thrown out of the anvil) for this issue, but i havent found one. I therefore would propose to add a modifiable integer value usedSacrificeAmount to the PrepareAnvilEvent (or maybe the AnvilInventory) along with all relevant methods, which would specify the maximum amount of items taken from the stack in the sacrifice slot. If sacrifice.getAmount() <= usedSacrificeAmount, the stack would be removed. The value should be initialized to the proper vanilla value (f.ex. 4 if a nearly depleted diamond pick is repaired with diamonds or 1 if it is repaired/enchanted with another diamond pick). If there is no vanilla result, the value would be 0.
Thank you for all the work you have put into this API and sorry for my bad english. (I'm german)