/
sandstone_type.go
77 lines (66 loc) · 1.4 KB
/
sandstone_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
package block
// SandstoneType represents a type of sandstone.
type SandstoneType struct {
sandstone
}
type sandstone uint8
// NormalSandstone is the normal variant of sandstone.
func NormalSandstone() SandstoneType {
return SandstoneType{0}
}
// CutSandstone is the cut variant of sandstone.
func CutSandstone() SandstoneType {
return SandstoneType{1}
}
// ChiseledSandstone is the chiseled variant of sandstone.
func ChiseledSandstone() SandstoneType {
return SandstoneType{2}
}
// SmoothSandstone is the smooth variant of sandstone.
func SmoothSandstone() SandstoneType {
return SandstoneType{3}
}
// Uint8 returns the sandstone as a uint8.
func (s sandstone) Uint8() uint8 {
return uint8(s)
}
// Hardness ...
func (s sandstone) Hardness() float64 {
switch s {
case 3:
return 2.0
}
return 0.8
}
// Name ...
func (s sandstone) Name() string {
switch s {
case 0:
return "Sandstone"
case 1:
return "Cut Sandstone"
case 2:
return "Chiseled Sandstone"
case 3:
return "Smooth Sandstone"
}
panic("unknown sandstone type")
}
// String ...
func (s sandstone) String() string {
switch s {
case 0:
return "default"
case 1:
return "cut"
case 2:
return "heiroglyphs"
case 3:
return "smooth"
}
panic("unknown sandstone type")
}
// SandstoneTypes ...
func SandstoneTypes() []SandstoneType {
return []SandstoneType{NormalSandstone(), CutSandstone(), ChiseledSandstone(), SmoothSandstone()}
}