Skip to content

Commit 16aec9c

Browse files
Fix legacy item/entity hover event + potion id in 1.21.4->1.21.5 (ViaVersion#4469)
1 parent c6cde5f commit 16aec9c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

common/src/main/java/com/viaversion/viaversion/protocols/v1_21_4to1_21_5/rewriter/ComponentRewriter1_21_5.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ private void updateShowEntityHover(final UserConnection connection, final Compou
304304

305305
final StringTag typeTag = contents.getStringTag("type");
306306
if (typeTag != null) {
307+
typeTag.setValue(protocol.getEntityRewriter().mappedEntityIdentifier(typeTag.getValue()));
307308
hoverEventTag.put("id", typeTag);
308309
}
309310
}
@@ -349,4 +350,9 @@ protected void handleWrittenBookContents(final UserConnection connection, final
349350
}
350351
}
351352
}
353+
354+
@Override
355+
protected SerializerVersion inputSerializerVersion() {
356+
return SerializerVersion.V1_21_4;
357+
}
352358
}

common/src/main/java/com/viaversion/viaversion/rewriter/text/NBTComponentRewriter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ protected void handleHoverEvent(final UserConnection connection, final CompoundT
5858
} else if (action.equals("show_entity")) {
5959
processTag(connection, hoverEventTag.get("name"));
6060

61-
final StringTag typeTag = hoverEventTag.getStringTag("id");
62-
if (typeTag != null && protocol.getEntityRewriter() != null) {
63-
typeTag.setValue(protocol.getEntityRewriter().mappedEntityIdentifier(typeTag.getValue()));
61+
final StringTag idTag = hoverEventTag.getStringTag("id");
62+
if (idTag != null && protocol.getEntityRewriter() != null) {
63+
idTag.setValue(protocol.getEntityRewriter().mappedEntityIdentifier(idTag.getValue()));
6464
}
6565
} else if (action.equals("show_item")) {
6666
final CompoundTag componentsTag = hoverEventTag.getCompoundTag("components");

0 commit comments

Comments
 (0)