forked from df-mc/dragonfly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ore_type.go
72 lines (62 loc) · 1.05 KB
/
ore_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
package block
// OreType represents a variant of ore blocks.
type OreType struct {
ore
}
// StoneOre returns the stone ore variant.
func StoneOre() OreType {
return OreType{0}
}
// DeepslateOre returns the deepslate ore variant.
func DeepslateOre() OreType {
return OreType{1}
}
// OreTypes returns a list of all ore types
func OreTypes() []OreType {
return []OreType{StoneOre(), DeepslateOre()}
}
type ore uint8
// Uint8 returns the ore as a uint8.
func (o ore) Uint8() uint8 {
return uint8(o)
}
// Name ...
func (o ore) Name() string {
switch o {
case 0:
return "Stone"
case 1:
return "Deepslate"
}
panic("unknown ore type")
}
// String ...
func (o ore) String() string {
switch o {
case 0:
return "stone"
case 1:
return "deepslate"
}
panic("unknown ore type")
}
// Prefix ...
func (o ore) Prefix() string {
switch o {
case 0:
return ""
case 1:
return "deepslate_"
}
panic("unknown ore type")
}
// Hardness ...
func (o ore) Hardness() float64 {
switch o {
case 0:
return 3
case 1:
return 4.5
}
panic("unknown ore type")
}