up3
Build and deploy / Build (push) Has been cancelled
Build and deploy / Update Contributors (push) Has been cancelled
Build and deploy / Deploy (push) Has been cancelled
Build and deploy / Build (push) Has been cancelled
Build and deploy / Update Contributors (push) Has been cancelled
Build and deploy / Deploy (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package item
|
||||
|
||||
import "github.com/df-mc/dragonfly/server/world"
|
||||
|
||||
// Cod is a food item obtained from cod. It can be cooked in a furnace, smoker, or campfire.
|
||||
type Cod struct {
|
||||
defaultFood
|
||||
|
||||
// Cooked is whether the cod is cooked.
|
||||
Cooked bool
|
||||
}
|
||||
|
||||
// Consume ...
|
||||
func (c Cod) Consume(_ *world.Tx, co Consumer) Stack {
|
||||
if c.Cooked {
|
||||
co.Saturate(5, 6)
|
||||
} else {
|
||||
co.Saturate(2, 0.4)
|
||||
}
|
||||
return Stack{}
|
||||
}
|
||||
|
||||
// SmeltInfo ...
|
||||
func (c Cod) SmeltInfo() SmeltInfo {
|
||||
if c.Cooked {
|
||||
return SmeltInfo{}
|
||||
}
|
||||
return newFoodSmeltInfo(NewStack(Cod{Cooked: true}, 1), 0.35)
|
||||
}
|
||||
|
||||
// EncodeItem ...
|
||||
func (c Cod) EncodeItem() (name string, meta int16) {
|
||||
if c.Cooked {
|
||||
return "minecraft:cooked_cod", 0
|
||||
}
|
||||
return "minecraft:cod", 0
|
||||
}
|
||||
Reference in New Issue
Block a user