Registries of BlockEntityType id
This commit is contained in:
24
data/registry/template.go.tmpl
Normal file
24
data/registry/template.go.tmpl
Normal file
@ -0,0 +1,24 @@
|
||||
// Code generated by {{Generator}}; DO NOT EDIT.
|
||||
package {{ .PackageName }}
|
||||
|
||||
{{ $typeName := .TypeName}}
|
||||
type {{$typeName}} int
|
||||
|
||||
func (n {{$typeName}}) String() string {
|
||||
if n < 0 || int(n) >= len(names) {
|
||||
return "<invalid {{$typeName}}>"
|
||||
}
|
||||
return names[n]
|
||||
}
|
||||
|
||||
const (
|
||||
{{- range $index, $elem := .Entries}}
|
||||
{{$elem | ToGoTypeName}} {{if eq $index 0 -}} {{$typeName}} = iota {{- end}}
|
||||
{{- end}}
|
||||
)
|
||||
|
||||
var names = []string{
|
||||
{{- range $index, $elem := .Entries}}
|
||||
{{printf "%q" $elem}},
|
||||
{{- end}}
|
||||
}
|
Reference in New Issue
Block a user