Bukkit.getUnsafe().getMaterial() won't match renamed block materials

    • Type: New Feature
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • None
    • 1.16.1 API
    • Yes

      While updating some material names store by a plugin I found an issue with renamed materials that don't have an item form.
      I'm using Bukkit.getUnsafe().getMaterial(oldMaterialName, 1631)
      1631 is the data version of 1.13.2. The implementation CraftMagicNumbers.getMaterial() is using an item stack to call the Minecraft data fixer to rename the material.
      The data fixer will ignore invalid ids, so block ids that are not renamed stay as they are. getMaterial will match the converted id with the Material enum. That won't work for wall_sign and the method returns null instead of oak_wall_sign.

      I really don't understand how to call those data fixers to rename block materials.

      Those materials have been renamed after 1.13:
      cactus_green -> green_dye
      dandelion_yellow -> yellow_dye
      rose_red -> red_dye
      sign -> oak_sign
      stone_slab -> smooth_stone_slab
      wall_sign -> null (should be oak_wall_sign)
      zombie_pigman_spawn_egg -> zombified_piglin_spawn_egg

       

            Assignee:
            Unassigned
            Reporter:
            Black Hole
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: