-
Notifications
You must be signed in to change notification settings - Fork 141
/
enchanted_apple.go
35 lines (29 loc) · 954 Bytes
/
enchanted_apple.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package item
import (
"github.com/df-mc/dragonfly/server/entity/effect"
"github.com/df-mc/dragonfly/server/world"
"time"
)
// EnchantedApple is a rare variant of the golden apple that has stronger effects.
type EnchantedApple struct{}
// AlwaysConsumable ...
func (EnchantedApple) AlwaysConsumable() bool {
return true
}
// ConsumeDuration ...
func (EnchantedApple) ConsumeDuration() time.Duration {
return DefaultConsumeDuration
}
// Consume ...
func (EnchantedApple) Consume(_ *world.World, c Consumer) Stack {
c.Saturate(4, 9.6)
c.AddEffect(effect.New(effect.Absorption{}, 4, 2*time.Minute))
c.AddEffect(effect.New(effect.Regeneration{}, 5, 30*time.Second))
c.AddEffect(effect.New(effect.FireResistance{}, 1, 5*time.Minute))
c.AddEffect(effect.New(effect.Resistance{}, 1, 5*time.Minute))
return Stack{}
}
// EncodeItem ...
func (EnchantedApple) EncodeItem() (name string, meta int16) {
return "minecraft:enchanted_golden_apple", 0
}