Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,12 @@ public Item handleItemToClient(UserConnection connection, Item item) {

if (item.identifier() == 358) { // map
Tag mapTag = tag.remove("map");
if (!gotRawIdFromTag && mapTag instanceof NumberTag) {
item.setData(((NumberTag) mapTag).asShort());
if (!gotRawIdFromTag && mapTag instanceof NumberTag numberTag) {
item.setData((short) (numberTag.asInt() & 0x7FFF));
// Keep original ID if conversion is lossy
if (numberTag.asInt() > Short.MAX_VALUE) {
tag.put("map", numberTag);
}
}
}

Expand Down Expand Up @@ -667,7 +671,9 @@ public Item handleItemToServer(UserConnection connection, Item item) {
}
if (item.identifier() == 358) { // map
if (tag == null) item.setTag(tag = new CompoundTag());
tag.putInt("map", item.data());
if (!tag.contains("map")) {
tag.putInt("map", item.data());
}
}

// NBT Changes
Expand Down