Fix maps not loading in Bedrock (#3218)

This commit is contained in:
David Choo 2022-08-09 21:35:26 -04:00 committed by GitHub
parent ef8130e7c0
commit 25a18a2e4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -33,7 +33,7 @@ public enum BedrockMapIcon {
ICON_ITEM_FRAME(MapIconType.GREEN_ARROW, 7), ICON_ITEM_FRAME(MapIconType.GREEN_ARROW, 7),
ICON_RED_ARROW(MapIconType.RED_ARROW, 2), ICON_RED_ARROW(MapIconType.RED_ARROW, 2),
ICON_BLUE_ARROW(MapIconType.BLUE_ARROW, 3), ICON_BLUE_ARROW(MapIconType.BLUE_ARROW, 3),
ICON_TREASURE_MARKER(MapIconType.TREASURE_MARKER, 4), ICON_WHITE_CROSS(MapIconType.WHITE_CROSS, 4, 0, 0, 0), // Doesn't exist on Bedrock, replaced with a black cross
ICON_RED_POINTER(MapIconType.RED_POINTER, 5), ICON_RED_POINTER(MapIconType.RED_POINTER, 5),
ICON_WHITE_CIRCLE(MapIconType.WHITE_CIRCLE, 6), ICON_WHITE_CIRCLE(MapIconType.WHITE_CIRCLE, 6),
ICON_SMALL_WHITE_CIRCLE(MapIconType.SMALL_WHITE_CIRCLE, 13), ICON_SMALL_WHITE_CIRCLE(MapIconType.SMALL_WHITE_CIRCLE, 13),
@ -54,7 +54,8 @@ public enum BedrockMapIcon {
ICON_BROWN_BANNER(MapIconType.BROWN_BANNER, 13, 131, 84, 50), ICON_BROWN_BANNER(MapIconType.BROWN_BANNER, 13, 131, 84, 50),
ICON_GREEN_BANNER(MapIconType.GREEN_BANNER, 13, 94, 124, 22), ICON_GREEN_BANNER(MapIconType.GREEN_BANNER, 13, 94, 124, 22),
ICON_RED_BANNER(MapIconType.RED_BANNER, 13, 176, 46, 38), ICON_RED_BANNER(MapIconType.RED_BANNER, 13, 176, 46, 38),
ICON_BLACK_BANNER(MapIconType.BLACK_BANNER, 13, 29, 29, 33); ICON_BLACK_BANNER(MapIconType.BLACK_BANNER, 13, 29, 29, 33),
ICON_TREASURE_MARKER(MapIconType.TREASURE_MARKER, 4);
private static final BedrockMapIcon[] VALUES = values(); private static final BedrockMapIcon[] VALUES = values();

View file

@ -28,6 +28,7 @@ package org.geysermc.geyser.translator.protocol.java.level;
import com.github.steveice10.mc.protocol.data.game.level.map.MapData; import com.github.steveice10.mc.protocol.data.game.level.map.MapData;
import com.github.steveice10.mc.protocol.data.game.level.map.MapIcon; import com.github.steveice10.mc.protocol.data.game.level.map.MapIcon;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundMapItemDataPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundMapItemDataPacket;
import com.nukkitx.math.vector.Vector3i;
import com.nukkitx.protocol.bedrock.data.MapDecoration; import com.nukkitx.protocol.bedrock.data.MapDecoration;
import com.nukkitx.protocol.bedrock.data.MapTrackedObject; import com.nukkitx.protocol.bedrock.data.MapTrackedObject;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -48,6 +49,7 @@ public class JavaMapItemDataTranslator extends PacketTranslator<ClientboundMapIt
mapItemDataPacket.setUniqueMapId(packet.getMapId()); mapItemDataPacket.setUniqueMapId(packet.getMapId());
mapItemDataPacket.setDimensionId(DimensionUtils.javaToBedrock(session.getDimension())); mapItemDataPacket.setDimensionId(DimensionUtils.javaToBedrock(session.getDimension()));
mapItemDataPacket.setLocked(packet.isLocked()); mapItemDataPacket.setLocked(packet.isLocked());
mapItemDataPacket.setOrigin(Vector3i.ZERO); // Required since 1.19.20
mapItemDataPacket.setScale(packet.getScale()); mapItemDataPacket.setScale(packet.getScale());
MapData data = packet.getData(); MapData data = packet.getData();