aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/LongTag.h
blob: 36ed4de9c48db1cc0c2901fab40ddca93d6b4860 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once
#include "Tag.h"

class LongTag : public Tag
{
public:
	int64_t data;
	LongTag(const wstring &name) : Tag(name) {}
	LongTag(const wstring &name, int64_t data) : Tag(name) {this->data = data; }

	void write(DataOutput *dos) { dos->writeLong(data); }
	void load(DataInput *dis, int tagDepth) { data = dis->readLong(); }

	byte getId() { return TAG_Long; }
	wstring toString()
	{
		static wchar_t buf[32];
		swprintf(buf,32,L"%I64d",data);
		return wstring(buf);
	}

	Tag *copy()
	{
		return new LongTag(getName(), data);
	}

	bool equals(Tag *obj)
	{
		if (Tag::equals(obj))
		{
			LongTag *o = static_cast<LongTag *>(obj);
			return data == o->data;
		}
		return false;
	}
};