Add BlockEntity support
This commit is contained in:
31
level/block/generator/blockentities/blockentities.go.tmpl
Normal file
31
level/block/generator/blockentities/blockentities.go.tmpl
Normal file
@ -0,0 +1,31 @@
|
||||
// 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}}
|
Reference in New Issue
Block a user