Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-6890

Add a way to specify the amount of sacrifice Items used in the Anvil

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • 1.18.1-R0.1-SNAPSHOT
    • Yes

      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)

            Doc Doc
            mfk1016 Kilian Nixda
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: