Skip to content

Commit

Permalink
Fix writing non-compound root NBT tags
Browse files Browse the repository at this point in the history
  • Loading branch information
md-5 committed Oct 14, 2023
1 parent a7dbbc2 commit c856876
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,18 @@ public static Tag readTag(ByteBuf input, int protocolVersion)

public static void writeTag(Tag tag, ByteBuf output, int protocolVersion)
{
DataOutputStream out = new DataOutputStream( new ByteBufOutputStream( output ) );
try
{
tag.write( new DataOutputStream( new ByteBufOutputStream( output ) ) );
if ( tag instanceof SpecificTag )
{
SpecificTag specificTag = (SpecificTag) tag;
specificTag.writeType( out );
specificTag.write( out );
} else
{
tag.write( out );
}
} catch ( IOException ex )
{
throw new RuntimeException( "Exception writing tag", ex );
Expand Down

0 comments on commit c856876

Please sign in to comment.