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

     1  package item
     2  
     3  import (
     4  	"github.com/df-mc/dragonfly/server/world"
     5  )
     6  
     7  // SuspiciousStew is a food item that can give the player a status effect that depends on the flower used to craft it.
     8  type SuspiciousStew struct {
     9  	defaultFood
    10  
    11  	// Type specifies the type of effect will be given to the player
    12  	Type StewType
    13  }
    14  
    15  // MaxCount ...
    16  func (SuspiciousStew) MaxCount() int {
    17  	return 1
    18  }
    19  
    20  // AlwaysConsumable ...
    21  func (SuspiciousStew) AlwaysConsumable() bool {
    22  	return true
    23  }
    24  
    25  // EncodeItem ...
    26  func (s SuspiciousStew) EncodeItem() (name string, meta int16) {
    27  	return "minecraft:suspicious_stew", int16(s.Type.Uint8())
    28  }
    29  
    30  // Consume ...
    31  func (s SuspiciousStew) Consume(_ *world.World, c Consumer) Stack {
    32  	for _, effect := range s.Type.Effects() {
    33  		c.AddEffect(effect)
    34  	}
    35  	c.Saturate(6, 7.2)
    36  
    37  	return NewStack(Bowl{}, 1)
    38  }