Skip to content

Commit 3beddaf

Browse files
committed
Move show item container contents conversion to the right place
Fixes ViaVersion#4444
1 parent 70139c6 commit 3beddaf

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,19 @@ protected void handleShowItem(final UserConnection connection, final CompoundTag
109109
handleEnchantments(componentsTag, "enchantments");
110110
handleEnchantments(componentsTag, "stored_enchantments");
111111

112+
// Usual item handling
113+
final CompoundTag useRemainder = TagUtil.getNamespacedCompoundTag(componentsTag, "use_remainder");
114+
if (useRemainder != null) {
115+
handleShowItem(connection, useRemainder);
116+
}
117+
handleContainerContents(connection, componentsTag);
118+
handleItemArrayContents(connection, componentsTag, "bundle_contents");
119+
handleItemArrayContents(connection, componentsTag, "charged_projectiles");
120+
handleWrittenBookContents(connection, componentsTag);
121+
122+
// NO MORE SNBT IN TEXT COMPONENTS
123+
updateUglyJson(componentsTag, connection);
124+
112125
removeDataComponents(componentsTag, StructuredDataKey.INSTRUMENT1_21_2, StructuredDataKey.JUKEBOX_PLAYABLE1_21);
113126
}
114127

@@ -218,22 +231,9 @@ private void updateShowItemHover(final UserConnection connection, final Compound
218231
final CompoundTag componentsTag = compoundContents.getCompoundTag("components");
219232
handleShowItem(connection, compoundContents, componentsTag);
220233

221-
if (componentsTag == null) {
222-
return;
234+
if (componentsTag != null) {
235+
hoverEventTag.put("components", componentsTag);
223236
}
224-
225-
hoverEventTag.put("components", componentsTag);
226-
227-
final CompoundTag useRemainder = TagUtil.getNamespacedCompoundTag(componentsTag, "use_remainder");
228-
if (useRemainder != null) {
229-
handleShowItem(connection, useRemainder);
230-
}
231-
handleContainerContents(connection, componentsTag);
232-
handleItemArrayContents(connection, componentsTag, "bundle_contents");
233-
handleItemArrayContents(connection, componentsTag, "charged_projectiles");
234-
handleWrittenBookContents(connection, componentsTag);
235-
236-
updateUglyJson(componentsTag, connection);
237237
} else if (contentsTag instanceof final StringTag inlinedContents) {
238238
hoverEventTag.put("id", inlinedContents);
239239
}
@@ -267,7 +267,7 @@ private void updateUglyJson(final CompoundTag componentsTag, final String key, f
267267
final String actualKey = TagUtil.getNamespacedTagKey(componentsTag, key);
268268
final String json = componentsTag.getString(actualKey);
269269
if (json == null) {
270-
return;
270+
return;
271271
}
272272

273273
componentsTag.put(actualKey, uglyJsonToTag(connection, json));

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ checkerQual = "3.49.1"
1919
paper = "1.20.4-R0.1-SNAPSHOT"
2020
legacyBukkit = "1.8.8-R0.1-SNAPSHOT"
2121
velocity = "3.1.1"
22-
viaProxy = "3.4.1-SNAPSHOT"
22+
viaProxy = "3.4.2-SNAPSHOT"
2323

2424
[libraries]
2525

0 commit comments

Comments
 (0)