aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/ByteTag.h
blob: ef2364720223ea0e5908d924bba8eb9c00b60406 (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 ByteTag : public Tag
{
public:
	byte data;
	ByteTag(const wstring &name) : Tag(name) {}
	ByteTag(const wstring &name, byte data) : Tag(name) {this->data = data; }
	
	void write(DataOutput *dos) { dos->writeByte(data); }
	void load(DataInput *dis, int tagDepth) { data = dis->readByte(); }

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

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

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