Add item DataComponent implements (part 1)

This commit is contained in:
Tnze
2024-07-28 17:52:41 +08:00
parent 966f50eb53
commit 090493c4ac
26 changed files with 860 additions and 256 deletions

View File

@ -1,17 +1,17 @@
package bootstrap
import (
"github.com/Tnze/go-mc/data/registryid"
"github.com/Tnze/go-mc/level/block"
"github.com/Tnze/go-mc/registry"
)
func RegisterBlocks(reg *registry.Registry[block.Block]) {
reg.Clear()
for i, key := range registryid.Block {
id, val := reg.Put(key, block.FromID[key])
if int32(i) != id || val == nil || *val == nil {
panic("register blocks failed")
}
}
}
package bootstrap
import (
"github.com/Tnze/go-mc/data/registryid"
"github.com/Tnze/go-mc/level/block"
"github.com/Tnze/go-mc/registry"
)
func RegisterBlocks(reg *registry.Registry[block.Block]) {
reg.Clear()
for i, key := range registryid.Block {
id, val := reg.Put(key, block.FromID[key])
if int32(i) != id || val == nil || *val == nil {
panic("register blocks failed")
}
}
}