File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
text-serializer-nbt/src/main/java/net/kyori/adventure/text/serializer/nbt Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -114,9 +114,19 @@ static final class Instances {
114
114
public @ NotNull Component deserialize (@ NotNull BinaryTag input ) {
115
115
if (input instanceof StringBinaryTag ) {
116
116
return Component .text (((StringBinaryTag ) input ).value ());
117
- }
117
+ } else if (input instanceof ListBinaryTag ) {
118
+ ListBinaryTag castTag = (ListBinaryTag ) input ;
119
+ if (castTag .isEmpty ()) {
120
+ throw new IllegalArgumentException ("The list binary tag must not be empty" );
121
+ }
122
+
123
+ Component rootTag = this .deserialize (castTag .get (0 ));
124
+ for (int index = 1 ; index < castTag .size (); index ++) {
125
+ rootTag = rootTag .append (this .deserialize (castTag .get (index )));
126
+ }
118
127
119
- if (!(input instanceof CompoundBinaryTag )) {
128
+ return rootTag ;
129
+ } else if (!(input instanceof CompoundBinaryTag )) {
120
130
throw new IllegalArgumentException ("The input isn't a compound or string binary tag" );
121
131
}
122
132
Original file line number Diff line number Diff line change 37
37
public final class NBTSerializerOptions {
38
38
39
39
/**
40
- * Whether to emit text components with no style and no children as plain text.
40
+ * Whether to emit text components with no style and no children as a plain text.
41
41
*
42
42
* @since 4.24.0
43
43
* @sinceMinecraft 1.20.3
@@ -92,7 +92,6 @@ public final class NBTSerializerOptions {
92
92
93
93
// TODO: Add show item hover data mode
94
94
// TODO: Add component type field emitting mode
95
- // TODO: Add a way to serialize components as lists
96
95
// TODO: Add source field emitting mode
97
96
// TODO: Add show item hover data mode
98
97
You can’t perform that action at this time.
0 commit comments