forked from df-mc/dragonfly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
anvil_type.go
46 lines (38 loc) · 995 Bytes
/
anvil_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
package block
// AnvilType represents a type of anvil, such as undamaged, slightly damaged, or very damaged.
type AnvilType struct {
anvil
}
// UndamagedAnvil returns the undamaged anvil type.
func UndamagedAnvil() AnvilType {
return AnvilType{0}
}
// SlightlyDamagedAnvil returns the slightly damaged anvil type.
func SlightlyDamagedAnvil() AnvilType {
return AnvilType{1}
}
// VeryDamagedAnvil returns the very damaged anvil type.
func VeryDamagedAnvil() AnvilType {
return AnvilType{2}
}
// AnvilTypes returns all anvil types.
func AnvilTypes() []AnvilType {
return []AnvilType{UndamagedAnvil(), SlightlyDamagedAnvil(), VeryDamagedAnvil()}
}
type anvil uint8
// Uint8 returns the anvil type as a uint8.
func (a anvil) Uint8() uint8 {
return uint8(a)
}
// String returns the anvil type as a string.
func (a anvil) String() string {
switch a {
case 0:
return "undamaged"
case 1:
return "slightly_damaged"
case 2:
return "very_damaged"
}
panic("should never happen")
}