-
Notifications
You must be signed in to change notification settings - Fork 141
/
firework_shape.go
77 lines (66 loc) · 1.54 KB
/
firework_shape.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
package item
// FireworkShape represents a shape of a firework.
type FireworkShape struct {
fireworkShape
}
// FireworkShapeSmallSphere is a small sphere firework.
func FireworkShapeSmallSphere() FireworkShape {
return FireworkShape{0}
}
// FireworkShapeHugeSphere is a huge sphere firework.
func FireworkShapeHugeSphere() FireworkShape {
return FireworkShape{1}
}
// FireworkShapeStar is a star firework.
func FireworkShapeStar() FireworkShape {
return FireworkShape{2}
}
// FireworkShapeCreeperHead is a creeper head firework.
func FireworkShapeCreeperHead() FireworkShape {
return FireworkShape{3}
}
// FireworkShapeBurst is a burst firework.
func FireworkShapeBurst() FireworkShape {
return FireworkShape{4}
}
type fireworkShape uint8
// Uint8 returns the firework as a uint8.
func (f fireworkShape) Uint8() uint8 {
return uint8(f)
}
// Name ...
func (f fireworkShape) Name() string {
switch f {
case 0:
return "Small Sphere"
case 1:
return "Huge Sphere"
case 2:
return "Star"
case 3:
return "Creeper Head"
case 4:
return "Burst"
}
panic("unknown firework type")
}
// String ...
func (f fireworkShape) String() string {
switch f {
case 0:
return "small_sphere"
case 1:
return "huge_sphere"
case 2:
return "star"
case 3:
return "creeper_head"
case 4:
return "burst"
}
panic("unknown firework type")
}
// FireworkShapes ...
func FireworkShapes() []FireworkShape {
return []FireworkShape{FireworkShapeSmallSphere(), FireworkShapeHugeSphere(), FireworkShapeStar(), FireworkShapeCreeperHead(), FireworkShapeBurst()}
}