LibZNI/NBT/API/NBTAccountant.cs

32 lines
No EOL
564 B
C#

namespace LibAC.NBT.API;
using System;
public class NBTAccountant
{
private static int _prettyIndex = 0;
public static void PrintRead(Tag tag)
{
tag.PrettyPrint(_prettyIndex, false);
}
public static void VisitTag()
{
_prettyIndex++;
}
public static void LeaveTag(Tag tag)
{
if (tag is CompoundTag ct)
{
ct.EndPrettyPrint(_prettyIndex);
}
else if (tag is ListTag lt)
{
lt.EndPrettyPrint(_prettyIndex);
}
_prettyIndex--;
}
}