Add item DataComponent implements (part 1)
This commit is contained in:
28
level/component/customname.go
Normal file
28
level/component/customname.go
Normal file
@ -0,0 +1,28 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/Tnze/go-mc/chat"
|
||||
)
|
||||
|
||||
var _ DataComponent = (*CustomName)(nil)
|
||||
|
||||
type CustomName struct {
|
||||
Name chat.Message
|
||||
}
|
||||
|
||||
// ID implements DataComponent.
|
||||
func (CustomName) ID() string {
|
||||
return "minecraft:custom_name"
|
||||
}
|
||||
|
||||
// ReadFrom implements DataComponent.
|
||||
func (c *CustomName) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
return c.Name.ReadFrom(r)
|
||||
}
|
||||
|
||||
// WriteTo implements DataComponent.
|
||||
func (c *CustomName) WriteTo(w io.Writer) (n int64, err error) {
|
||||
return c.Name.WriteTo(w)
|
||||
}
|
Reference in New Issue
Block a user