Files
go-mc/level/block/generator/blockentities/blockentities.go.tmpl
2022-12-18 18:28:08 +08:00

32 lines
755 B
Cheetah

// Code generated by {{Generator}}; DO NOT EDIT.
package block
{{/* type (
{{- range .}}
{{.Name | ToGoTypeName}}Entity struct {}
{{- end}}
) */}}
var EntityList = [...]Entity{
{{- range .}}
{{.Name | ToGoTypeName}}Entity{},
{{- end}}
}
{{- range .}}
func ({{.Name | ToGoTypeName}}Entity) ID() string { return {{.Name | printf "%q"}} }
{{- end}}
{{range .}}
func ({{.Name | ToFuncReceiverName}} {{.Name | ToGoTypeName}}Entity) IsValidBlock(block Block) bool {
{{if eq 1 (len .ValidBlocks)}}return block.ID() == {{index .ValidBlocks 0 | printf "%q"}}{{else}}switch block.ID() {
case {{index .ValidBlocks 0 | printf "%q"}}{{range slice .ValidBlocks 1}},
{{. | printf "%q"}}{{end}}:
return true
default:
return false
}{{end}}
}
{{end}}