forked from df-mc/dragonfly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
muddy_mangrove_roots.go
60 lines (50 loc) · 1.58 KB
/
muddy_mangrove_roots.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
package block
import (
"github.com/Adrian8115/dragonfly-Amethyst-Protocol/server/block/cube"
"github.com/Adrian8115/dragonfly-Amethyst-Protocol/server/item"
"github.com/Adrian8115/dragonfly-Amethyst-Protocol/server/world"
"github.com/go-gl/mathgl/mgl64"
)
// MuddyMangroveRoots are a decorative variant of mangrove roots.
type MuddyMangroveRoots struct {
solid
// Axis is the axis which the muddy mangrove roots faces.
Axis cube.Axis
}
// BreakInfo ...
func (m MuddyMangroveRoots) BreakInfo() BreakInfo {
return newBreakInfo(0.7, alwaysHarvestable, shovelEffective, oneOf(m))
}
// SoilFor ...
func (MuddyMangroveRoots) SoilFor(block world.Block) bool {
switch block.(type) {
case TallGrass, DoubleTallGrass, Flower, DoubleFlower, NetherSprouts:
return true
}
return false
}
// UseOnBlock ...
func (m MuddyMangroveRoots) UseOnBlock(pos cube.Pos, face cube.Face, _ mgl64.Vec3, w *world.World, user item.User, ctx *item.UseContext) (used bool) {
pos, face, used = firstReplaceable(w, pos, face, m)
if !used {
return
}
m.Axis = face.Axis()
place(w, pos, m, user, ctx)
return placed(ctx)
}
// EncodeItem ...
func (MuddyMangroveRoots) EncodeItem() (name string, meta int16) {
return "minecraft:muddy_mangrove_roots", 0
}
// EncodeBlock ...
func (m MuddyMangroveRoots) EncodeBlock() (string, map[string]any) {
return "minecraft:muddy_mangrove_roots", map[string]any{"pillar_axis": m.Axis.String()}
}
// allMuddyMangroveRoots ...
func allMuddyMangroveRoots() (roots []world.Block) {
for _, axis := range cube.Axes() {
roots = append(roots, MuddyMangroveRoots{Axis: axis})
}
return
}