Files
minego/pkg/protocol/slot/component.go
2025-08-22 05:14:59 +08:00

24 lines
406 B
Go

package slot
import pk "github.com/Tnze/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
}