github.com/df-mc/dragonfly@v0.9.13/server/block/melon.go (about)

     1  package block
     2  
     3  import (
     4  	"github.com/df-mc/dragonfly/server/item"
     5  	"math/rand"
     6  )
     7  
     8  // Melon is a fruit block that grows from melon stems.
     9  type Melon struct {
    10  	solid
    11  }
    12  
    13  // BreakInfo ...
    14  func (m Melon) BreakInfo() BreakInfo {
    15  	return newBreakInfo(1, alwaysHarvestable, axeEffective, silkTouchDrop(item.NewStack(item.MelonSlice{}, rand.Intn(5)+3), item.NewStack(m, 1)))
    16  }
    17  
    18  // CompostChance ...
    19  func (Melon) CompostChance() float64 {
    20  	return 0.65
    21  }
    22  
    23  // EncodeItem ...
    24  func (Melon) EncodeItem() (name string, meta int16) {
    25  	return "minecraft:melon_block", 0
    26  }
    27  
    28  // EncodeBlock ...
    29  func (Melon) EncodeBlock() (string, map[string]any) {
    30  	return "minecraft:melon_block", nil
    31  }