github.com/df-mc/dragonfly@v0.9.13/server/block/fire_type.go (about) 1 package block 2 3 // FireType represents a type of fire. Used by flaming blocks such as torches, lanterns, fire, and campfires. 4 type FireType struct { 5 fire 6 } 7 8 type fire uint8 9 10 // NormalFire is the default variant of fires 11 func NormalFire() FireType { 12 return FireType{0} 13 } 14 15 // SoulFire is a turquoise variant of normal fire 16 func SoulFire() FireType { 17 return FireType{1} 18 } 19 20 // Uint8 returns the fire as a uint8. 21 func (f fire) Uint8() uint8 { 22 return uint8(f) 23 } 24 25 // LightLevel returns the light level of the fire. 26 func (f fire) LightLevel() uint8 { 27 switch f { 28 case 0: 29 return 15 30 case 1: 31 return 10 32 } 33 panic("unknown fire type") 34 } 35 36 // Damage returns the amount of damage taken by entities inside the fire. 37 func (f fire) Damage() float64 { 38 switch f { 39 case 0: 40 return 1 41 case 1: 42 return 2 43 } 44 panic("unknown fire type") 45 } 46 47 // Name ... 48 func (f fire) Name() string { 49 switch f { 50 case 0: 51 return "Fire" 52 case 1: 53 return "Soul Fire" 54 } 55 panic("unknown fire type") 56 } 57 58 // String ... 59 func (f fire) String() string { 60 switch f { 61 case 0: 62 return "normal" 63 case 1: 64 return "soul" 65 } 66 panic("unknown fire type") 67 } 68 69 // FireTypes ... 70 func FireTypes() []FireType { 71 return []FireType{NormalFire(), SoulFire()} 72 }