mojira.dev
MC-148050

A map's "frame" icon always points east when the map is put into an item frame on the floor or ceiling

The Bug

When placing an unlocked map into an item frame, a "frame" marker is created (the green arrow) which faces the same direction as the map. When placed on the ground and celing specifically though, it always faces to the right.

Steps to Reproduce

/give @p map
/give @p item_frame
  1. Use map item

  2. Place map in item frame

Code Analysis / MCP 1.20.1

When the frame icon is created on the map, it sets the rotation of the icon to be equal to the map's direction (-1 for down & up, 0 for south, 1 for west, 2 for north, and 3 for east) multiplied by 90. This means that any time a map is put on the ground or ceiling, it will always equal -90, or in this case, visually facing right.

One possible fix, is to add another map icon similar to the frame icon, but does not have a point/arrow on in. This new icon could be used when the map is facing up or down instead,
Below is the affected code, with a preposed fix:

net.minecraft.world.level.saveddata.maps/MapItemSavedData.java - tickCarriedBy()
. . .
         MapFrame mapframe = new MapFrame(blockpos, itemframe.getDirection().get2DDataValue() * 90, itemframe.getId());
         this.addDecoration(
Issue Start:
                 MapDecoration.Type.FRAME, player.level(), "frame-" + itemframe.getId(), blockpos.getX(), blockpos.getZ(), itemframe.getDirection().get2DDataValue() * 90, null
Issue End:
         );
         this.frameMarkers.put(mapframe.getId(), mapframe);
         . . .

Possible Fix:

if (itemframe.getDirection().get2DDataValue() == -1) {
            this.addDecoration(MapDecoration.Type.NEW_MAP_ICON, player.level(), "frame-" + itemframe.getId(), blockpos.getX(), blockpos.getZ(), 180, null);
         } else {
            this.addDecoration(MapDecoration.Type.FRAME, player.level(), "frame-" + itemframe.getId(), blockpos.getX(), blockpos.getZ(), itemframe.getDirection().get2DDataValue() * 90, null);
         }
         this.frameMarkers.put(mapframe.getId(), mapframe);

Related issues

Attachments

Comments

migrated
[media]
Avoma

Can confirm in 20w51a.

[Mod] Jingy

Requesting ownership of this issue

[Mod] Jingy

(Unassigned)

Confirmed

Maps

directional, map, map-marker

Minecraft 1.13.2, Minecraft 1.14 Pre-Release 2, 20w09a, 20w51a, 1.20.2, ..., 1.20.4, 24w09a, 1.20.5, 1.21.1, 24w39a

Retrieved