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