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

     1  package item
     2  
     3  import "github.com/df-mc/dragonfly/server/world"
     4  
     5  // Mutton is a food item obtained from sheep. It can be cooked in a furnace, smoker, or campfire.
     6  type Mutton struct {
     7  	defaultFood
     8  
     9  	// Cooked is whether the mutton is cooked.
    10  	Cooked bool
    11  }
    12  
    13  // Consume ...
    14  func (m Mutton) Consume(_ *world.World, c Consumer) Stack {
    15  	if m.Cooked {
    16  		c.Saturate(6, 9.6)
    17  	} else {
    18  		c.Saturate(2, 1.2)
    19  	}
    20  	return Stack{}
    21  }
    22  
    23  // SmeltInfo ...
    24  func (m Mutton) SmeltInfo() SmeltInfo {
    25  	if m.Cooked {
    26  		return SmeltInfo{}
    27  	}
    28  	return newFoodSmeltInfo(NewStack(Mutton{Cooked: true}, 1), 0.35)
    29  }
    30  
    31  // EncodeItem ...
    32  func (m Mutton) EncodeItem() (name string, meta int16) {
    33  	if m.Cooked {
    34  		return "minecraft:cooked_mutton", 0
    35  	}
    36  	return "minecraft:mutton", 0
    37  }