-
Notifications
You must be signed in to change notification settings - Fork 140
/
wool.go
48 lines (39 loc) · 1.14 KB
/
wool.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
package block
import (
"github.com/df-mc/dragonfly/server/block/instrument"
"github.com/df-mc/dragonfly/server/world"
)
// Wool is a colourful block that can be obtained by killing/shearing sheep, or crafted using four string.
type Wool struct {
solid
// Colour is the colour of the wool.
Colour Colour
}
// Instrument ...
func (w Wool) Instrument() instrument.Instrument {
return instrument.Guitar()
}
// FlammabilityInfo ...
func (w Wool) FlammabilityInfo() FlammabilityInfo {
return newFlammabilityInfo(30, 60, true)
}
// BreakInfo ...
func (w Wool) BreakInfo() BreakInfo {
return newBreakInfo(0.8, alwaysHarvestable, shearsEffective, oneOf(w))
}
// EncodeItem ...
func (w Wool) EncodeItem() (name string, meta int16) {
return "minecraft:wool", int16(w.Colour.Uint8())
}
// EncodeBlock ...
func (w Wool) EncodeBlock() (name string, properties map[string]interface{}) {
return "minecraft:wool", map[string]interface{}{"color": w.Colour.String()}
}
// allWool returns wool blocks with all possible colours.
func allWool() []world.Block {
b := make([]world.Block, 0, 16)
for _, c := range Colours() {
b = append(b, Wool{Colour: c})
}
return b
}