forked from df-mc/dragonfly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spore_blossom.go
67 lines (56 loc) · 1.76 KB
/
spore_blossom.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
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/Adrian8115/dragonfly-Amethyst-Protocol/server/world/particle"
"github.com/go-gl/mathgl/mgl64"
)
// SporeBlossom is a decorative block.
type SporeBlossom struct {
empty
transparent
}
// HasLiquidDrops ...
func (s SporeBlossom) HasLiquidDrops() bool {
return true
}
// NeighbourUpdateTick ...
func (s SporeBlossom) NeighbourUpdateTick(pos, _ cube.Pos, w *world.World) {
if !w.Block(pos.Side(cube.FaceUp)).Model().FaceSolid(pos.Side(cube.FaceUp), cube.FaceDown, w) {
w.SetBlock(pos, nil, nil)
w.AddParticle(pos.Vec3Centre(), particle.BlockBreak{Block: s})
}
}
// UseOnBlock ...
func (s SporeBlossom) UseOnBlock(pos cube.Pos, face cube.Face, _ mgl64.Vec3, w *world.World, user item.User, ctx *item.UseContext) (used bool) {
pos, _, used = firstReplaceable(w, pos, face, s)
if !used {
return
}
if !w.Block(pos.Side(cube.FaceUp)).Model().FaceSolid(pos.Side(cube.FaceUp), cube.FaceDown, w) {
return
}
place(w, pos, s, user, ctx)
return placed(ctx)
}
// BreakInfo ...
func (s SporeBlossom) BreakInfo() BreakInfo {
return newBreakInfo(0, alwaysHarvestable, nothingEffective, oneOf(s))
}
// FlammabilityInfo ...
func (SporeBlossom) FlammabilityInfo() FlammabilityInfo {
return newFlammabilityInfo(15, 100, true)
}
// CompostChance ...
func (SporeBlossom) CompostChance() float64 {
return 0.65
}
// EncodeItem ...
func (s SporeBlossom) EncodeItem() (name string, meta int16) {
return "minecraft:spore_blossom", 0
}
// EncodeBlock ...
func (s SporeBlossom) EncodeBlock() (string, map[string]any) {
return "minecraft:spore_blossom", nil
}