Files
mc/server/block/dirt_path.go
T
TarnaWijaya 26ed99fda6
Build and deploy / Build (push) Has been cancelled
Build and deploy / Update Contributors (push) Has been cancelled
Build and deploy / Deploy (push) Has been cancelled
up3
2026-07-09 08:33:57 +08:00

42 lines
1.1 KiB
Go

package block
import (
"github.com/df-mc/dragonfly/server/block/cube"
"github.com/df-mc/dragonfly/server/world"
)
// DirtPath is a decorative block that can be created by using a shovel on a dirt or grass block.
type DirtPath struct {
tilledGrass
transparent
}
// Till ...
func (p DirtPath) Till() (world.Block, bool) {
return Farmland{}, true
}
// NeighbourUpdateTick handles the turning from dirt path into dirt if a block is placed on top of it.
func (p DirtPath) NeighbourUpdateTick(pos, _ cube.Pos, tx *world.Tx) {
up := pos.Side(cube.FaceUp)
if tx.Block(up).Model().FaceSolid(up, cube.FaceDown, tx) {
// A block with a solid side at the bottom was placed onto this one.
tx.SetBlock(pos, Dirt{}, nil)
}
}
// BreakInfo ...
func (p DirtPath) BreakInfo() BreakInfo {
return newBreakInfo(0.65, alwaysHarvestable, shovelEffective, silkTouchOneOf(Dirt{}, p))
}
// EncodeItem ...
func (DirtPath) EncodeItem() (name string, meta int16) {
return "minecraft:grass_path", 0
}
// EncodeBlock ...
func (DirtPath) EncodeBlock() (string, map[string]any) {
return "minecraft:grass_path", nil
}