65 lines
No EOL
1.5 KiB
C#
65 lines
No EOL
1.5 KiB
C#
using System;
|
|
using LibAC.NBT.API;
|
|
|
|
namespace LibAC.NBT
|
|
{
|
|
public class LongTag : Tag
|
|
{
|
|
public long value { get; private set; } = 0;
|
|
|
|
public LongTag() { }
|
|
|
|
public LongTag(long value)
|
|
{
|
|
this.value = value;
|
|
}
|
|
|
|
public static LongTag ValueOf(long value)
|
|
{
|
|
return new LongTag(value);
|
|
}
|
|
|
|
public override void ReadValue(ByteLayer data)
|
|
{
|
|
value = data.ReadLong();
|
|
}
|
|
|
|
public override void WriteValue(ByteLayer data)
|
|
{
|
|
data.WriteLong(value);
|
|
}
|
|
|
|
public override TagType GetTagType()
|
|
{
|
|
return TagType.Long;
|
|
}
|
|
|
|
public override void SetValue(dynamic val)
|
|
{
|
|
if (val is long) value = val;
|
|
}
|
|
|
|
public override dynamic GetValue()
|
|
{
|
|
return value;
|
|
}
|
|
|
|
public override void PrettyPrint(int indent, bool recurse)
|
|
{
|
|
Console.WriteLine($"{new string('\t', indent)}{Tag.GetCanonicalName(GetTagType())}: {value}");
|
|
}
|
|
|
|
public override void WriteStringifiedValue(StringBuilder builder, int indent, bool isList)
|
|
{
|
|
builder.Append($"{(isList ? new string('\t', indent) : "")}{value}L");
|
|
}
|
|
|
|
public override void ReadStringifiedValue(StringReader reader)
|
|
{
|
|
long val = long.Parse(reader.ReadNumber());
|
|
value = val;
|
|
|
|
reader.Expect('l');
|
|
}
|
|
}
|
|
} |