Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-144406

Banners, player indicator and decorations can not be marked on the outermost pixel of a map

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • Minecraft 19w07a, Minecraft 19w08b, Minecraft 19w09a, 1.15.1, 1.15.2 Pre-Release 1, 1.15.2, 20w09a, 20w13b, 20w14a, 20w15a, 20w16a, 20w17a, 1.16 Pre-release 8, 1.16 Release Candidate 1, 1.16, 1.16.2 Release Candidate 1, 1.16.2 Release Candidate 2, 1.16.2, 1.16.3, 1.16.4, 20w46a, 20w49a, 20w51a, 1.16.5, 21w05a, 21w06a, 21w17a, 21w18a, 1.17 Pre-release 1, 1.17 Pre-release 2, 21w37a, 21w39a, 1.18 Pre-release 4, 1.18.2, 22w15a, 22w16b, 1.19 Pre-release 1, 22w44a, 23w12a, 23w14a, 23w16a, 23w17a, 1.20 Pre-release 1, 1.20 Pre-release 2, 1.20 Pre-release 5, 1.20 Pre-release 7, 1.20 Release Candidate 1, 1.20, 1.20.2 Pre-release 1
    • Community Consensus
    • Maps
    • Low

    Description

      The bug

      A banner within the area represented on the outermost pixel of a map can not be marked. With a freshly crafted map, this is only one block on each side, but as you zoom out it becomes as much as sixteen (thirty-two, when you consider that the next map over has the same problem!)

      Code analysis and fix

      Decompiled code analysis on 1.19.4:

      net.minecraft.item.map.MapState

      The logic and range used to determine if a banner falls within the current map bounds is incorrect.

      line 294 in private void addIcon and
      line 386 in public boolean addBanner

      if (f >= -63.0F && g >= -63.0F && f <= 63.0F && g <= 63.0F)
      

      Range >=-63 and <=63 is too narrow and will miss a row of 1 block on each side of the map. This is compounded once the scale is calculated as up to 16 blocks on each side will be missed once the banner coordinate is converted to a float on the 128 block scale of the map. The logic should be >=-64 and <64, this will ensure all positions in all scales are included on the map. The range of blocks on the map if the center of the map is 0,0 is -64 to 63 in both axes.

      Solution:

      if (f >= -64.0F && g >= -64.0F && f < 64.0F && g < 64.0F)
      

      I've made a fabric mod using mixins that fixes this server side if devs are interested.

      Attachments

        Activity

          People

            Unassigned Unassigned
            Greener greener.ca
            Votes:
            28 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              CHK: