Add item DataComponent implements (part 2)
This commit is contained in:
47
level/component/food.go
Normal file
47
level/component/food.go
Normal file
@ -0,0 +1,47 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
pk "github.com/Tnze/go-mc/net/packet"
|
||||
)
|
||||
|
||||
var _ DataComponent = (*Food)(nil)
|
||||
|
||||
type Food struct {
|
||||
Nutrition pk.VarInt
|
||||
Saturation pk.Float
|
||||
CanAlwaysEat pk.Boolean
|
||||
EatSeconds pk.Float
|
||||
// TODO: using_converts_to
|
||||
// TODO: effects
|
||||
}
|
||||
|
||||
// ID implements DataComponent.
|
||||
func (Food) ID() string {
|
||||
return "minecraft:food"
|
||||
}
|
||||
|
||||
// ReadFrom implements DataComponent.
|
||||
func (f *Food) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
pk.Tuple{
|
||||
&f.Nutrition,
|
||||
&f.Saturation,
|
||||
&f.CanAlwaysEat,
|
||||
&f.EatSeconds,
|
||||
// TODO
|
||||
}.ReadFrom(r)
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// WriteTo implements DataComponent.
|
||||
func (f *Food) WriteTo(w io.Writer) (n int64, err error) {
|
||||
pk.Tuple{
|
||||
&f.Nutrition,
|
||||
&f.Saturation,
|
||||
&f.CanAlwaysEat,
|
||||
&f.EatSeconds,
|
||||
// TODO
|
||||
}.WriteTo(w)
|
||||
panic("unimplemented")
|
||||
}
|
Reference in New Issue
Block a user