@@ -210,6 +210,9 @@ private static Component readComponent(DataInput input, TagType rootType, int de
210
210
while ((type = resolveNbtType (input .readByte ())) != TagType .END ) {
211
211
String key = input .readUTF ();
212
212
switch (key ) {
213
+ // this case resolves an edge-case where a simple component would
214
+ // be serialized to an unnamed compound because of nbt lists
215
+ case "" :
213
216
case TEXT :
214
217
requireType (type , TagType .STRING );
215
218
requireState (text == null );
@@ -249,7 +252,7 @@ private static Component readComponent(DataInput input, TagType rootType, int de
249
252
scoreObjective = input .readUTF ();
250
253
break ;
251
254
default :
252
- throw new IllegalStateException ("Invalid nbt key read for score key: " + scoreKey );
255
+ throw new IllegalStateException ("Invalid nbt key read for score key: ' " + scoreKey + "'" );
253
256
}
254
257
}
255
258
requireState (scoreName != null && scoreObjective != null );
@@ -368,7 +371,7 @@ private static Component readComponent(DataInput input, TagType rootType, int de
368
371
clickEventAction = ClickEvent .Action .COPY_TO_CLIPBOARD ;
369
372
break ;
370
373
default :
371
- throw new IllegalStateException ("Illegal click event action read: " + actionId );
374
+ throw new IllegalStateException ("Illegal click event action read: ' " + actionId + "'" );
372
375
}
373
376
break ;
374
377
case CLICK_EVENT_VALUE :
@@ -377,7 +380,7 @@ private static Component readComponent(DataInput input, TagType rootType, int de
377
380
clickEventValue = input .readUTF ();
378
381
break ;
379
382
default :
380
- throw new IllegalStateException ("Illegal click event nbt key read: " + clickKey );
383
+ throw new IllegalStateException ("Illegal click event nbt key read: ' " + clickKey + "'" );
381
384
}
382
385
}
383
386
requireState (clickEventAction != null && clickEventValue != null );
@@ -406,7 +409,7 @@ private static Component readComponent(DataInput input, TagType rootType, int de
406
409
hoverEventAction = HoverEvent .Action .SHOW_ENTITY ;
407
410
break ;
408
411
default :
409
- throw new IllegalStateException ("Illegal hover event action read: " + actionId );
412
+ throw new IllegalStateException ("Illegal hover event action read: ' " + actionId + "'" );
410
413
}
411
414
break ;
412
415
case HOVER_EVENT_CONTENTS :
@@ -489,13 +492,13 @@ private static Component readComponent(DataInput input, TagType rootType, int de
489
492
}
490
493
break ;
491
494
default :
492
- throw new IllegalStateException ("Illegal hover event nbt key read: " + hoverKey );
495
+ throw new IllegalStateException ("Illegal hover event nbt key read: ' " + hoverKey + "'" );
493
496
}
494
497
}
495
498
requireState (hoverEventContents != null );
496
499
break ;
497
500
default :
498
- throw new IllegalStateException ("Illegal component nbt key read: " + key );
501
+ throw new IllegalStateException ("Illegal component nbt key read: ' " + key + "'" );
499
502
}
500
503
}
501
504
0 commit comments