(comp *text.TextComponent)
| 248 | } |
| 249 | |
| 250 | func (r Reader) TextComponent(comp *text.TextComponent) error { |
| 251 | var tag int8 |
| 252 | if err := r.Byte(&tag); err != nil { |
| 253 | return err |
| 254 | } |
| 255 | switch tag { |
| 256 | case nbt.String: |
| 257 | return r.nbtString(&comp.Text) |
| 258 | case nbt.Compound: |
| 259 | return r.NBT(comp) |
| 260 | default: |
| 261 | return fmt.Errorf("invalid text component root compound") |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | func (r Reader) nbtString(v *string) error { |
| 266 | var stringlen int16 |