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

Expand Enchantment API

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • This server is running CraftBukkit version 4267-Spigot-5bbef5a-403accd (MC: 1.21) (Implementing API version 1.21-R0.1-SNAPSHOT)
    • Yes

      1.20.5 deprecated Enchantment#getItemTarget, directing users to Tags instead of EnchantmentTargets. However, there is no provided link from Enchantment to Tag to replace the deprecated API.
      The equivalent would be to expose net.minecraft.world.item.enchantment.Enchantment#getSupportedItems(). https://www.spigotmc.org/threads/trying-to-understand-enchantment-getitemtarget-replacement.645621/

      With the advent of custom enchantments via data pack, I would like access to all aspects of a net.minecraft.world.item.enchantment.Enchantment.EnchantmentDefinition that are not currently available: supported items (all valid/anvil-applicable targets), primary items (if defined, a separate tag of enchanting table targets), slots (the equipment slots in which the enchantment takes effect), and the various values used to calculate offered enchantments (weight, min cost, max cost, and anvil cost).

      My use case is redefining enchantment calculations to allow customization of enchantment table and anvils. Previously I felt relatively secure in providing my own copies of definitions for these values (the calculations for the result using them are internal magic anyway, so it didn't seem appropriate to include in the API), but now that there may be custom enchantments provided, my NMS fallback, which I had included only to reduce breakages caused by new enchantments, will see regular use.

            Unassigned Unassigned
            Jikoo Jikoo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: