forked from df-mc/dragonfly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fire_type.go
72 lines (62 loc) · 1.18 KB
/
fire_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
// FireType represents a type of fire. Used by flaming blocks such as torches, lanterns, fire, and campfires.
type FireType struct {
fire
}
type fire uint8
// NormalFire is the default variant of fires
func NormalFire() FireType {
return FireType{0}
}
// SoulFire is a turquoise variant of normal fire
func SoulFire() FireType {
return FireType{1}
}
// Uint8 returns the fire as a uint8.
func (f fire) Uint8() uint8 {
return uint8(f)
}
// LightLevel returns the light level of the fire.
func (f fire) LightLevel() uint8 {
switch f {
case 0:
return 15
case 1:
return 10
}
panic("unknown fire type")
}
// Damage returns the amount of damage taken by entities inside the fire.
func (f fire) Damage() float64 {
switch f {
case 0:
return 1
case 1:
return 2
}
panic("unknown fire type")
}
// Name ...
func (f fire) Name() string {
switch f {
case 0:
return "Fire"
case 1:
return "Soul Fire"
}
panic("unknown fire type")
}
// String ...
func (f fire) String() string {
switch f {
case 0:
return "normal"
case 1:
return "soul"
}
panic("unknown fire type")
}
// FireTypes ...
func FireTypes() []FireType {
return []FireType{NormalFire(), SoulFire()}
}