Skip to content

Commit da4ee5c

Browse files
Throw out object components in 1.21.9->1.21.7
Closes #1107
1 parent 917427c commit da4ee5c

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_9to1_21_7/rewriter/ComponentRewriter1_21_9.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package com.viaversion.viabackwards.protocol.v1_21_9to1_21_7.rewriter;
1919

2020
import com.viaversion.nbt.tag.CompoundTag;
21+
import com.viaversion.nbt.tag.StringTag;
2122
import com.viaversion.viabackwards.api.BackwardsProtocol;
2223
import com.viaversion.viabackwards.api.rewriters.text.NBTComponentRewriter;
2324
import com.viaversion.viaversion.api.connection.UserConnection;
@@ -30,6 +31,26 @@ public ComponentRewriter1_21_9(final BackwardsProtocol<ClientboundPacket1_21_9,
3031
super(protocol);
3132
}
3233

34+
@Override
35+
protected void processCompoundTag(final UserConnection connection, final CompoundTag tag) {
36+
super.processCompoundTag(connection, tag);
37+
38+
// Throw out the same object type and it's new properties
39+
final String type = tag.getString("type");
40+
if ("object".equals(type)) {
41+
tag.putString("text", "");
42+
tag.remove("type");
43+
}
44+
if (tag.remove("sprite") != null) {
45+
tag.putString("text", "");
46+
}
47+
if (tag.remove("player") != null) {
48+
tag.putString("text", "");
49+
}
50+
tag.remove("atlas");
51+
tag.remove("font");
52+
}
53+
3354
@Override
3455
protected void handleShowItem(final UserConnection connection, final CompoundTag itemTag, final CompoundTag componentsTag) {
3556
super.handleShowItem(connection, itemTag, componentsTag);

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
projectVersion=5.5.0
1+
projectVersion=5.5.1-SNAPSHOT
22

33
# Smile emoji (note that modrinth may not have added the version on release yet)
44
mcVersions=1.21.9, 1.21.8, 1.21.7, 1.21.6, 1.21.5, 1.21.4, 1.21.3, 1.21.2, 1.21.1, 1.21, 1.20.6, 1.20.5, 1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10

0 commit comments

Comments
 (0)