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

ItemStack#deserialize(args) does not convert damaged anvils

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • This server is running CraftBukkit version git-Bukkit-29e7564 (MC: 1.13) (Implementing API version 1.13-R0.1-SNAPSHOT)
    • Yes

      The bug is that a 'damaged' anvil from 1.12.2, serialized as an Itemstack using ItemStack#serialize(); does not properly deserialize in 1.13 using ItemStack.deserialize(args) using a map with the same contents.

       

      Reproduction steps.

      1. Note that given a Slightly Damaged Anvil in 1.12.2, its corresponding Material Enum is ANVIL and has a damage value of 1. As a result, using ItemStack#serialize() returns a map with 2 entries. <"type", "ANVIL"> and <"damage", 1>.
      2. In a plugin running 1.13, create/obtain a map containing the above two entries. Then using ItemStack.deserialize(map). It returns a plain anvil item. Not the damaged variety that is desired. I expect to get a "CHIPPED_ANVIL"

      I have included a very simple plugin example showing the proof of concept. Hacking in a command "/getanvil". Which creates the above mentioned map and deserializing. The item placed in the player inventory is a normal Anvil.
      Other flattened materials do not have this issue, just an anomaly with anvils.

       

      The only other item I am suspicious about, is white beds. Colored beds were added in 1.12 where beds were converted to Red beds (?damage value 14?). I witnessed a white bed get converted to a red bed during my 1.12->1.13 conversion. But I have not extensively tested that part to see if it is suffering the same issue as these anvils.

       

      Below is the disclosure statement that I read and understand. This is a bug with the Bukkit API, no concept of Vanilla testing is appropriate as normal world conversion seems fine.

      PPS: Bug reports which do not 1) contain a declaration of testing in Vanilla and without plugins, or 2) in the case of plugin API bugs, contain a minimal reproduction case (source + jar please) will be closed. Bug reports must contain step by step instructions to reproduce the bug from a clean server install with no assumptions or prior knowledge. Also make sure you include the full output of /version in your report. Please copy and paste this statement to the bottom of your report to indicate that you have read and understood it.

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

              Created:
              Updated:
              Resolved: