Skip to content

Commit 7eb0522

Browse files
committed
Also remove data component overrides in hover events
Fixes ViaVersion/ViaVersion#4395
1 parent 3f6c172 commit 7eb0522

File tree

3 files changed

+5
-16
lines changed

3 files changed

+5
-16
lines changed

common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/ComponentRewriter1_21_2.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,9 @@ protected void handleShowItem(final UserConnection connection, final CompoundTag
5454
food.putFloat("eat_seconds", 1.6F);
5555
}
5656

57-
TagUtil.removeNamespaced(componentsTag, "repairable");
58-
TagUtil.removeNamespaced(componentsTag, "enchantable");
59-
TagUtil.removeNamespaced(componentsTag, "consumable");
60-
TagUtil.removeNamespaced(componentsTag, "use_remainder");
61-
TagUtil.removeNamespaced(componentsTag, "use_cooldown");
62-
TagUtil.removeNamespaced(componentsTag, "item_model");
63-
TagUtil.removeNamespaced(componentsTag, "equippable");
64-
TagUtil.removeNamespaced(componentsTag, "glider");
65-
TagUtil.removeNamespaced(componentsTag, "tooltip_style");
66-
TagUtil.removeNamespaced(componentsTag, "death_protection");
67-
TagUtil.removeNamespaced(componentsTag, "damage_resistant");
68-
TagUtil.removeNamespaced(componentsTag, "lock");
57+
removeDataComponents(componentsTag, "repairable", "enchantable", "consumable",
58+
"use_remainder", "use_cooldown", "item_model", "equippable", "glider",
59+
"tooltip_style", "death_protection", "damage_resistant", "lock");
6960
}
7061

7162
@Override

common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_4to1_21_2/rewriter/ComponentRewriter1_21_4.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import com.viaversion.viaversion.api.connection.UserConnection;
2424
import com.viaversion.viaversion.protocols.v1_21to1_21_2.packet.ClientboundPacket1_21_2;
2525
import com.viaversion.viaversion.util.SerializerVersion;
26-
import com.viaversion.viaversion.util.TagUtil;
2726

2827
public final class ComponentRewriter1_21_4 extends JsonNBTComponentRewriter<ClientboundPacket1_21_2> {
2928

@@ -38,8 +37,7 @@ protected void handleShowItem(final UserConnection connection, final CompoundTag
3837
return;
3938
}
4039

41-
TagUtil.removeNamespaced(componentsTag, "custom_model_data");
42-
TagUtil.removeNamespaced(componentsTag, "trim");
40+
removeDataComponents(componentsTag, "custom_model_data", "trim");
4341
}
4442

4543
@Override

common/src/main/java/com/viaversion/viabackwards/protocol/v1_21to1_20_5/rewriter/ComponentRewriter1_21.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ private void convertAttributeModifiersComponent(final CompoundTag tag) {
6868
protected void handleShowItem(final UserConnection connection, final CompoundTag itemTag, final CompoundTag componentsTag) {
6969
super.handleShowItem(connection, itemTag, componentsTag);
7070
if (componentsTag != null) {
71-
TagUtil.removeNamespaced(componentsTag, "jukebox_playable");
71+
removeDataComponents(componentsTag, "jukebox_playable");
7272
convertAttributeModifiersComponent(componentsTag);
7373
}
7474
}

0 commit comments

Comments
 (0)