forked from df-mc/dragonfly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
coral_type.go
98 lines (85 loc) · 1.75 KB
/
coral_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
package block
import (
"github.com/Adrian8115/dragonfly-Amethyst-Protocol/server/item"
)
// CoralType represents a type of coral of a block. CoralType, coral fans, and coral blocks carry one of these types.
type CoralType struct {
coral
}
// TubeCoral returns the tube coral variant
func TubeCoral() CoralType {
return CoralType{0}
}
// BrainCoral returns the brain coral variant
func BrainCoral() CoralType {
return CoralType{1}
}
// BubbleCoral returns the bubble coral variant
func BubbleCoral() CoralType {
return CoralType{2}
}
// FireCoral returns the fire coral variant
func FireCoral() CoralType {
return CoralType{3}
}
// HornCoral returns the horn coral variant
func HornCoral() CoralType {
return CoralType{4}
}
// CoralTypes returns all coral types.
func CoralTypes() []CoralType {
return []CoralType{TubeCoral(), BrainCoral(), BubbleCoral(), FireCoral(), HornCoral()}
}
type coral uint8
// Uint8 returns the coral as a uint8.
func (c coral) Uint8() uint8 {
return uint8(c)
}
// Colour returns the colour of the CoralType.
func (c coral) Colour() item.Colour {
switch c {
case 0:
return item.ColourBlue()
case 1:
return item.ColourPink()
case 2:
return item.ColourPurple()
case 3:
return item.ColourRed()
case 4:
return item.ColourYellow()
}
panic("unknown coral type")
}
// Name ...
func (c coral) Name() string {
switch c {
case 0:
return "Tube Coral"
case 1:
return "Brain Coral"
case 2:
return "Bubble Coral"
case 3:
return "Fire Coral"
case 4:
return "Horn Coral"
}
panic("unknown coral type")
}
// String ...
func (c coral) String() string {
switch c {
case 0:
return "tube"
case 1:
return "brain"
case 2:
return "bubble"
case 3:
return "fire"
case 4:
return "horn"
}
panic("unknown coral type")
}