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

Spigot filters invalid enchants from being sent to the client

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • None
    • None

      I've only tested this on 1.11+ versions, as that's the only versions where this is relevant.

      As you might already know, mojang chose to change the way their clients consider an item "enchanted", thus adding the enchantment glow. Before 1.11, any items having the "ench" tag, empty or not, would have the enchantment glint on them. After 1.11 this behavior was changed: Now items not only have to have the "ench" tag, but that list also has to contain some elements, valid or not it doesn't matter.
      So in order to add the enchantment glint on an item without adding an actual enchant (which we certainly DON'T want, because players may want to further enchant that item with real enchants, and if we apply the HideEnchants flag on it players won't see the enchants they added), we could simply specify an invalid enchant id and any level we want and the client will still render the glint on the item, although it won't actually display any enchantments.

      While this works just nice in vanilla (ex. command: /give @p Dirt 1 0 {ench:[\{lvl:-1s, id:-1s}]} - will give you an enchanted dirt block without actual enchantments), doing the same thing while using the Spigot server won't work. My guess is that there's some sort of invalid enchantment filter in place which blocks invalid enchants from being sent to the client, but I really can't see the use of such thing, as it's blocking many nice applications that could be done this way. Also, I'm sure it doesn't block any kinds of "custom" tags you might add to the item. Using a slightly modified version of the official 1.11 client compiled from the code provided by MCP, I added a debug message for each item in a player's inventory displaying it's nbt tag compound, and it did actually display any custom tags I tried adding to items, so I think this "filter" only works for enchantments. If you could fix this annoying bug, you would certainly improve the experience for both plugin developers and map-makers who use spigot as their server of choice.
      Thanks!

            Unassigned Unassigned
            dadus33 Vlad Ardelean
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: