Initialize Commit
This commit is contained in:
22
codec/slot/component.go
Normal file
22
codec/slot/component.go
Normal file
@ -0,0 +1,22 @@
|
||||
package slot
|
||||
|
||||
import pk "github.com/Tnze/go-mc/net/packet"
|
||||
|
||||
type Component interface {
|
||||
Type() ComponentID
|
||||
ID() string
|
||||
|
||||
pk.Field
|
||||
}
|
||||
|
||||
type ComponentID int32
|
||||
|
||||
var components = make(map[ComponentID]Component)
|
||||
|
||||
func ComponentFromID(id ComponentID) Component {
|
||||
return components[id]
|
||||
}
|
||||
|
||||
func RegisterComponent(c Component) {
|
||||
components[c.Type()] = c
|
||||
}
|
Reference in New Issue
Block a user