github.com/df-mc/dragonfly@v0.9.13/server/item/melon_slice.go (about) 1 package item 2 3 import ( 4 "github.com/df-mc/dragonfly/server/world" 5 "time" 6 ) 7 8 // MelonSlice is a food item dropped by melon blocks. 9 type MelonSlice struct{} 10 11 // AlwaysConsumable ... 12 func (m MelonSlice) AlwaysConsumable() bool { 13 return false 14 } 15 16 // ConsumeDuration ... 17 func (m MelonSlice) ConsumeDuration() time.Duration { 18 return DefaultConsumeDuration 19 } 20 21 // Consume ... 22 func (m MelonSlice) Consume(_ *world.World, c Consumer) Stack { 23 c.Saturate(2, 1.2) 24 return Stack{} 25 } 26 27 // CompostChance ... 28 func (MelonSlice) CompostChance() float64 { 29 return 0.5 30 } 31 32 // EncodeItem ... 33 func (m MelonSlice) EncodeItem() (name string, meta int16) { 34 return "minecraft:melon_slice", 0 35 }