Files
TarnaWijaya 26ed99fda6
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
up3
2026-07-09 08:33:57 +08:00

38 lines
746 B
Go

package item
import "github.com/df-mc/dragonfly/server/world"
// Rabbit is a food item obtained from rabbits. It can be cooked in a furnace, smoker, or campfire.
type Rabbit struct {
defaultFood
// Cooked is whether the rabbit is cooked.
Cooked bool
}
// Consume ...
func (r Rabbit) Consume(_ *world.Tx, c Consumer) Stack {
if r.Cooked {
c.Saturate(5, 6)
} else {
c.Saturate(3, 1.8)
}
return Stack{}
}
// SmeltInfo ...
func (r Rabbit) SmeltInfo() SmeltInfo {
if r.Cooked {
return SmeltInfo{}
}
return newFoodSmeltInfo(NewStack(Rabbit{Cooked: true}, 1), 0.35)
}
// EncodeItem ...
func (r Rabbit) EncodeItem() (name string, meta int16) {
if r.Cooked {
return "minecraft:cooked_rabbit", 0
}
return "minecraft:rabbit", 0
}