github.com/df-mc/dragonfly@v0.9.13/server/block/nether_sprouts.go (about) 1 package block 2 3 import ( 4 "github.com/df-mc/dragonfly/server/block/cube" 5 "github.com/df-mc/dragonfly/server/item" 6 "github.com/df-mc/dragonfly/server/world" 7 "github.com/go-gl/mathgl/mgl64" 8 ) 9 10 // NetherSprouts are a non-solid plant block that generate in warped forests. 11 type NetherSprouts struct { 12 transparent 13 replaceable 14 empty 15 } 16 17 // NeighbourUpdateTick ... 18 func (n NetherSprouts) NeighbourUpdateTick(pos, _ cube.Pos, w *world.World) { 19 if !supportsVegetation(n, w.Block(pos.Side(cube.FaceDown))) { 20 w.SetBlock(pos, nil, nil) //TODO: Nylium & mycelium 21 } 22 } 23 24 // UseOnBlock ... 25 func (n NetherSprouts) UseOnBlock(pos cube.Pos, face cube.Face, _ mgl64.Vec3, w *world.World, user item.User, ctx *item.UseContext) bool { 26 pos, _, used := firstReplaceable(w, pos, face, n) 27 if !used { 28 return false 29 } 30 if !supportsVegetation(n, w.Block(pos.Side(cube.FaceDown))) { 31 return false //TODO: Nylium & mycelium 32 } 33 34 place(w, pos, n, user, ctx) 35 return placed(ctx) 36 } 37 38 // HasLiquidDrops ... 39 func (n NetherSprouts) HasLiquidDrops() bool { 40 return false 41 } 42 43 // FlammabilityInfo ... 44 func (n NetherSprouts) FlammabilityInfo() FlammabilityInfo { 45 return newFlammabilityInfo(0, 0, true) 46 } 47 48 // BreakInfo ... 49 func (n NetherSprouts) BreakInfo() BreakInfo { 50 return newBreakInfo(0, func(t item.Tool) bool { 51 return t.ToolType() == item.TypeShears 52 }, nothingEffective, oneOf(n)) 53 } 54 55 // CompostChance ... 56 func (NetherSprouts) CompostChance() float64 { 57 return 0.5 58 } 59 60 // EncodeItem ... 61 func (n NetherSprouts) EncodeItem() (name string, meta int16) { 62 return "minecraft:nether_sprouts", 0 63 } 64 65 // EncodeBlock ... 66 func (n NetherSprouts) EncodeBlock() (string, map[string]any) { 67 return "minecraft:nether_sprouts", nil 68 }