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

MapPalette Valid Range for getColor(byte) Needs Updating for 1.12


    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • MacOS

    • Magic

      I have a plugin that setsĀ blocks in-game from map items (e.g. pixel art using wool blocks). It works using MapPalette.imageToBytes, and then passing each of those bytes to MapPalette.getColor(byte).

      This worked prior to 1.12, but now in 1.12 I will sometimes get an IndexOutOfBoundsException.

      I believe this is due to the commit that added more colors:


      But the valid ranges for bytes was not updated to include the new colors:


      I am not certain I know how to fix this correctly myself, so I would appreciate some feedback. If no one has a fix ready I will give it a shot when I get a chance.

      It may also be that matchColor needs updating as well, though I am not sure.

            Unassigned Unassigned
            NathanWolf Nathan Wolf
            0 Vote for this issue
            2 Start watching this issue