mojira.dev
MC-144406

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

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.20.4:

net.minecraft.item.map.MapState

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

in {{private void addIcon}} and 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)

Plus a few changes in the player tracking:

 

if (f < -64.0f) { b = -128; }
if (g < -64.0f) { c = -128; }
if (f >= 64.0f) { b = 127; }
if (g >= 64.0f) { c = 127; }

 

and
 

byte b = (byte)((double)(f*2.0f));
byte c = (byte)((double)(g*2.0f));

 

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

Linked issues

Attachments

Comments 24

Does MC-144121 describe your issue?

No. The maps display fine, but a banner placed in the last map pixel on any edge can't be marked. I made a quick example in a superflat creative world to better demonstrate it:

 

[media]

The pink banners can be marked on their respective maps. The white and black banners can't be marked on either map.

 

In this case, with the maps zoomed all the way in, it's easily circumventable by just moving the banner over a block, but it's always the outer map-pixel, so on a max zoomed out map it's a 16-block strip on each side of the map, for a total gap of 32 blocks. That can be a major problem if you happened to build right on the edge!

 

The world itself (for 19w08b) is attached if you want to see for yourself.

I ran into this today on 1.15.1, banners on edges can't be marked.

Can we get a confirmation and an affects 1.15.1 please?

Affects 1.15.2 Pre-Release 1

14 more comments

Affects 1.16 Release Candidate 1

Affects 1.16.2 Pre-Release 1

Affects 1.16.2 Pre-release 2

affects 1.16.2 Release Candidate 1

⚠️ Please do not mark Unreleased Versions as affected. You don't have access to them yet.

-- I am a bot. This action was performed automatically! If you think it was incorrect, please notify us on Discord or Reddit

Keiya

Greener

(Unassigned)

Community Consensus

Platform

Low

Maps

banner, filled_map, map, map-marker, mapping

Minecraft 19w07a, Minecraft 19w08b, Minecraft 19w09a, 1.15.1, 1.15.2 Pre-Release 1, ..., 24w39a, 1.21.5, 25w16a, 25w21a, 1.21.6 Pre-Release 3

Retrieved