github.com/df-mc/dragonfly@v0.9.13/server/block/dirt_path.go (about) 1 package block 2 3 import ( 4 "github.com/df-mc/dragonfly/server/block/cube" 5 "github.com/df-mc/dragonfly/server/world" 6 ) 7 8 // DirtPath is a decorative block that can be created by using a shovel on a dirt or grass block. 9 type DirtPath struct { 10 tilledGrass 11 transparent 12 } 13 14 // Till ... 15 func (p DirtPath) Till() (world.Block, bool) { 16 return Farmland{}, true 17 } 18 19 // NeighbourUpdateTick handles the turning from dirt path into dirt if a block is placed on top of it. 20 func (p DirtPath) NeighbourUpdateTick(pos, _ cube.Pos, w *world.World) { 21 up := pos.Side(cube.FaceUp) 22 if w.Block(up).Model().FaceSolid(up, cube.FaceDown, w) { 23 // A block with a solid side at the bottom was placed onto this one. 24 w.SetBlock(pos, Dirt{}, nil) 25 } 26 } 27 28 // BreakInfo ... 29 func (p DirtPath) BreakInfo() BreakInfo { 30 return newBreakInfo(0.65, alwaysHarvestable, shovelEffective, silkTouchOneOf(Dirt{}, p)) 31 } 32 33 // EncodeItem ... 34 func (DirtPath) EncodeItem() (name string, meta int16) { 35 return "minecraft:grass_path", 0 36 } 37 38 // EncodeBlock ... 39 func (DirtPath) EncodeBlock() (string, map[string]any) { 40 return "minecraft:grass_path", nil 41 }