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

     1  package item
     2  
     3  import (
     4  	"github.com/df-mc/dragonfly/server/world"
     5  )
     6  
     7  // Apple is a food item that can be eaten by the player.
     8  type Apple struct {
     9  	defaultFood
    10  }
    11  
    12  // Consume ...
    13  func (a Apple) Consume(_ *world.World, c Consumer) Stack {
    14  	c.Saturate(4, 2.4)
    15  	return Stack{}
    16  }
    17  
    18  // CompostChance ...
    19  func (Apple) CompostChance() float64 {
    20  	return 0.65
    21  }
    22  
    23  // EncodeItem ...
    24  func (a Apple) EncodeItem() (name string, meta int16) {
    25  	return "minecraft:apple", 0
    26  }