-
Notifications
You must be signed in to change notification settings - Fork 140
/
concrete.go
39 lines (32 loc) · 978 Bytes
/
concrete.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
package block
import (
"github.com/df-mc/dragonfly/server/world"
)
// Concrete is a solid block which comes in the 16 regular dye colors, created by placing concrete powder
// adjacent to water.
type Concrete struct {
solid
bassDrum
// Colour is the colour of the concrete block.
Colour Colour
}
// BreakInfo ...
func (c Concrete) BreakInfo() BreakInfo {
return newBreakInfo(1.8, pickaxeHarvestable, pickaxeEffective, oneOf(c))
}
// EncodeItem ...
func (c Concrete) EncodeItem() (name string, meta int16) {
return "minecraft:concrete", int16(c.Colour.Uint8())
}
// EncodeBlock ...
func (c Concrete) EncodeBlock() (name string, properties map[string]interface{}) {
return "minecraft:concrete", map[string]interface{}{"color": c.Colour.String()}
}
// allConcrete returns concrete blocks with all possible colours.
func allConcrete() []world.Block {
b := make([]world.Block, 0, 16)
for _, c := range Colours() {
b = append(b, Concrete{Colour: c})
}
return b
}