forked from df-mc/dragonfly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wall_connection_type.go
59 lines (50 loc) · 1.32 KB
/
wall_connection_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
package block
// WallConnectionType represents the connection type of a wall.
type WallConnectionType struct {
wallConnectionType
}
// NoWallConnection returns the no connection type of a wall.
func NoWallConnection() WallConnectionType {
return WallConnectionType{0}
}
// ShortWallConnection returns the short connection type of a wall.
func ShortWallConnection() WallConnectionType {
return WallConnectionType{1}
}
// TallWallConnection returns the tall connection type of a wall.
func TallWallConnection() WallConnectionType {
return WallConnectionType{2}
}
// WallConnectionTypes returns a list of all wall connection types.
func WallConnectionTypes() []WallConnectionType {
return []WallConnectionType{NoWallConnection(), ShortWallConnection(), TallWallConnection()}
}
type wallConnectionType uint8
// Uint8 returns the wall connection as a uint8.
func (w wallConnectionType) Uint8() uint8 {
return uint8(w)
}
// String ...
func (w wallConnectionType) String() string {
switch w {
case 0:
return "none"
case 1:
return "short"
case 2:
return "tall"
}
panic("unknown wall connection type")
}
// Height returns the height of the connection for the block model.
func (w wallConnectionType) Height() float64 {
switch w {
case 0:
return 0
case 1:
return 0.75
case 2:
return 1
}
panic("unknown wall connection type")
}