github.com/df-mc/dragonfly@v0.9.13/server/entity/effect/hunger.go (about)

     1  package effect
     2  
     3  import (
     4  	"github.com/df-mc/dragonfly/server/world"
     5  	"image/color"
     6  	"time"
     7  )
     8  
     9  // Hunger is a lasting effect that causes an affected player to gradually lose saturation and food.
    10  type Hunger struct {
    11  	nopLasting
    12  }
    13  
    14  // Apply ...
    15  func (Hunger) Apply(e world.Entity, lvl int, _ time.Duration) {
    16  	if i, ok := e.(interface {
    17  		Exhaust(points float64)
    18  	}); ok {
    19  		i.Exhaust(float64(lvl) * 0.005)
    20  	}
    21  }
    22  
    23  // RGBA ...
    24  func (Hunger) RGBA() color.RGBA {
    25  	return color.RGBA{R: 0x58, G: 0x76, B: 0x53, A: 0xff}
    26  }