summaryrefslogtreecommitdiff
path: root/nbt
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2013-08-06 22:23:23 +0200
committerKevin Chabowski <kevin@kch42.de>2013-08-06 22:23:23 +0200
commitdf3bbe12423bef6f9a04d53966ec9394de07edee (patch)
tree9a7fcbd3796908b45acf4c03966001a96b4b09f3 /nbt
parent6719fd37d59cbf42750d3d8ca1709f22432bf486 (diff)
downloadgonbt-df3bbe12423bef6f9a04d53966ec9394de07edee.tar.gz
gonbt-df3bbe12423bef6f9a04d53966ec9394de07edee.tar.bz2
gonbt-df3bbe12423bef6f9a04d53966ec9394de07edee.zip
Moved tag types to own file.
Diffstat (limited to 'nbt')
-rw-r--r--nbt/nbt.go48
-rw-r--r--nbt/tagtypes.go51
2 files changed, 51 insertions, 48 deletions
diff --git a/nbt/nbt.go b/nbt/nbt.go
index d66705d..26bace5 100644
--- a/nbt/nbt.go
+++ b/nbt/nbt.go
@@ -6,54 +6,6 @@ import (
"io"
)
-const (
- TAG_End = iota
- TAG_Byte
- TAG_Short
- TAG_Int
- TAG_Long
- TAG_Float
- TAG_Double
- TAG_Byte_Array
- TAG_String
- TAG_List
- TAG_Compound
- TAG_Int_Array
-)
-
-type TagType byte
-
-func (tt TagType) String() string {
- switch tt {
- case TAG_End:
- return "TAG_End"
- case TAG_Byte:
- return "TAG_Byte"
- case TAG_Short:
- return "TAG_Short"
- case TAG_Int:
- return "TAG_Int"
- case TAG_Long:
- return "TAG_Long"
- case TAG_Float:
- return "TAG_Float"
- case TAG_Double:
- return "TAG_Double"
- case TAG_Byte_Array:
- return "TAG_Byte_Array"
- case TAG_String:
- return "TAG_String"
- case TAG_List:
- return "TAG_List"
- case TAG_Compound:
- return "TAG_Compound"
- case TAG_Int_Array:
- return "TAG_Int_Array"
- default:
- return "TAG_Unknown"
- }
-}
-
type Tag struct {
Type TagType
Payload interface{}
diff --git a/nbt/tagtypes.go b/nbt/tagtypes.go
new file mode 100644
index 0000000..161e64a
--- /dev/null
+++ b/nbt/tagtypes.go
@@ -0,0 +1,51 @@
+package nbt
+
+// Valid TagType values.
+const (
+ TAG_End = iota
+ TAG_Byte
+ TAG_Short
+ TAG_Int
+ TAG_Long
+ TAG_Float
+ TAG_Double
+ TAG_Byte_Array
+ TAG_String
+ TAG_List
+ TAG_Compound
+ TAG_Int_Array
+)
+
+// TagType describes the type of a NBT tag. Valid values are the TAG_* constants.
+type TagType byte
+
+func (tt TagType) String() string {
+ switch tt {
+ case TAG_End:
+ return "TAG_End"
+ case TAG_Byte:
+ return "TAG_Byte"
+ case TAG_Short:
+ return "TAG_Short"
+ case TAG_Int:
+ return "TAG_Int"
+ case TAG_Long:
+ return "TAG_Long"
+ case TAG_Float:
+ return "TAG_Float"
+ case TAG_Double:
+ return "TAG_Double"
+ case TAG_Byte_Array:
+ return "TAG_Byte_Array"
+ case TAG_String:
+ return "TAG_String"
+ case TAG_List:
+ return "TAG_List"
+ case TAG_Compound:
+ return "TAG_Compound"
+ case TAG_Int_Array:
+ return "TAG_Int_Array"
+ default:
+ return "TAG_Unknown"
+ }
+}