Files
minego/pkg/protocol/slot/component.go
2025-08-27 20:28:44 +08:00

26 lines
423 B
Go

package slot
import (
pk "git.konjactw.dev/falloutBot/go-mc/net/packet"
)
type Component interface {
Type() ComponentID
ID() string
pk.Field
}
type ComponentID int32
type componentCreator func() Component
var components = make(map[ComponentID]componentCreator)
func ComponentFromID(id ComponentID) Component {
return components[id]()
}
func RegisterComponent(c componentCreator) {
components[c().Type()] = c
}