-
Notifications
You must be signed in to change notification settings - Fork 144
/
disc_type.go
168 lines (145 loc) · 2.99 KB
/
disc_type.go
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
package sound
// DiscType represents the type of music disc. Typically, Minecraft has a total of 15 music discs.
type DiscType struct {
disc
}
// Disc13 returns the music disc "13".
func Disc13() DiscType {
return DiscType{0}
}
// DiscCat returns the music disc "cat".
func DiscCat() DiscType {
return DiscType{1}
}
// DiscBlocks returns the music disc "blocks".
func DiscBlocks() DiscType {
return DiscType{2}
}
// DiscChirp returns the music disc "chirp".
func DiscChirp() DiscType {
return DiscType{3}
}
// DiscFar returns the music disc "far".
func DiscFar() DiscType {
return DiscType{4}
}
// DiscMall returns the music disc "mall".
func DiscMall() DiscType {
return DiscType{5}
}
// DiscMellohi returns the music disc "mellohi".
func DiscMellohi() DiscType {
return DiscType{6}
}
// DiscStal returns the music disc "stal".
func DiscStal() DiscType {
return DiscType{7}
}
// DiscStrad returns the music disc "strad".
func DiscStrad() DiscType {
return DiscType{8}
}
// DiscWard returns the music disc "ward".
func DiscWard() DiscType {
return DiscType{9}
}
// Disc11 returns the music disc "11".
func Disc11() DiscType {
return DiscType{10}
}
// DiscWait returns the music disc "wait".
func DiscWait() DiscType {
return DiscType{11}
}
// DiscOtherside returns the music disc "otherside".
func DiscOtherside() DiscType {
return DiscType{12}
}
// DiscPigstep returns the music disc "Pigstep".
func DiscPigstep() DiscType {
return DiscType{13}
}
// Disc5 returns the music disc "5".
func Disc5() DiscType {
return DiscType{14}
}
// DiscRelic returns the music disc "Relic".
func DiscRelic() DiscType {
return DiscType{15}
}
// MusicDiscs returns a list of all existing music discs.
func MusicDiscs() []DiscType {
return []DiscType{
Disc13(), DiscCat(), DiscBlocks(), DiscChirp(), DiscFar(), DiscMall(), DiscMellohi(), DiscStal(),
DiscStrad(), DiscWard(), Disc11(), DiscWait(), DiscOtherside(), DiscPigstep(), Disc5(), DiscRelic(),
}
}
// disc is the underlying value of a DiscType struct.
type disc uint8
// Uint8 converts the disc to an integer that uniquely identifies its type.
func (d disc) Uint8() uint8 {
return uint8(d)
}
// String ...
func (d disc) String() string {
switch d {
case 0:
return "13"
case 1:
return "cat"
case 2:
return "blocks"
case 3:
return "chirp"
case 4:
return "far"
case 5:
return "mall"
case 6:
return "mellohi"
case 7:
return "stal"
case 8:
return "strad"
case 9:
return "ward"
case 10:
return "11"
case 11:
return "wait"
case 12:
return "otherside"
case 13:
return "pigstep"
case 14:
return "5"
case 15:
return "relic"
}
panic("unknown record type")
}
// DisplayName ...
func (d disc) DisplayName() string {
switch d {
case 13:
return "Pigstep"
case 15:
return "Relic"
}
return d.String()
}
// Author ...
func (d disc) Author() string {
if d <= 11 {
return "C418"
}
switch d {
case 12, 13:
return "Lena Raine"
case 14:
return "Samuel Åberg"
case 15:
return "Aaron Cherof"
}
panic("unknown record type")
}