Skip to content

Commit b1a8e47

Browse files
author
UserNugget
committed
Fix LimboPlayer::sendImage on 1.20.5+
1 parent 4f1d58d commit b1a8e47

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

plugin/src/main/java/net/elytrium/limboapi/server/LimboPlayerImpl.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ public void sendImage(int mapID, BufferedImage image, boolean sendItem) {
123123
@Override
124124
public void sendImage(int mapID, BufferedImage image, boolean sendItem, boolean resize) {
125125
if (sendItem) {
126-
this.setInventory(
127-
36,
128-
SimpleItem.fromItem(Item.FILLED_MAP),
129-
1,
130-
mapID,
131-
this.version.compareTo(ProtocolVersion.MINECRAFT_1_17) < 0
132-
? null
133-
: CompoundBinaryTag.builder().put("map", IntBinaryTag.intBinaryTag(mapID)).build()
134-
);
126+
if (this.version.noLessThan(ProtocolVersion.MINECRAFT_1_20_5)) {
127+
this.setInventory(36, SimpleItem.fromItem(Item.FILLED_MAP), 1, mapID,
128+
this.plugin.createItemComponentMap().add(ProtocolVersion.MINECRAFT_1_20_5, "minecraft:map_id", 0));
129+
} else if (this.version.noLessThan(ProtocolVersion.MINECRAFT_1_17)) {
130+
this.setInventory(36, SimpleItem.fromItem(Item.FILLED_MAP), 1, mapID,
131+
CompoundBinaryTag.builder().put("map", IntBinaryTag.intBinaryTag(mapID)).build());
132+
} else {
133+
this.setInventory(36, SimpleItem.fromItem(Item.FILLED_MAP), 1, mapID, (CompoundBinaryTag) null);
134+
}
135135
}
136136

137137
if (image.getWidth() != MapData.MAP_DIM_SIZE || image.getHeight() != MapData.MAP_DIM_SIZE) {

0 commit comments

Comments
 (0)