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

This commit is contained in:
2026-07-09 08:33:57 +08:00
commit 26ed99fda6
845 changed files with 75419 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
package item
import "github.com/df-mc/dragonfly/server/world"
// Porkchop is a food item obtained from pigs. It can be cooked in a furnace, smoker, or campfire.
type Porkchop struct {
defaultFood
// Cooked is whether the porkchop is cooked.
Cooked bool
}
// Consume ...
func (p Porkchop) Consume(_ *world.Tx, c Consumer) Stack {
if p.Cooked {
c.Saturate(8, 12.8)
} else {
c.Saturate(3, 1.8)
}
return Stack{}
}
// SmeltInfo ...
func (p Porkchop) SmeltInfo() SmeltInfo {
if p.Cooked {
return SmeltInfo{}
}
return newFoodSmeltInfo(NewStack(Porkchop{Cooked: true}, 1), 0.35)
}
// EncodeItem ...
func (p Porkchop) EncodeItem() (name string, meta int16) {
if p.Cooked {
return "minecraft:cooked_porkchop", 0
}
return "minecraft:porkchop", 0
}