Remove SetItemRuntimeID method and update item mapping initialization

This commit is contained in:
AkmalFairuz
2025-07-02 23:09:47 +07:00
parent 127fc0c3bd
commit 833d854b3d
5 changed files with 10975 additions and 28 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,6 @@ package legacyver
import (
_ "embed"
"github.com/akmalfairuz/legacy-version/mapping"
"github.com/sandertv/gophertunnel/minecraft/nbt"
)
const (
@@ -18,30 +17,14 @@ var (
requiredItemList818 []byte
//go:embed data/block_states_818.nbt
blockStateData818 []byte
//go:embed data/dragonfly_latest_vanilla_items.nbt
dragonflyLatestVanillaItemsRaw []byte
dragonflyLatestItemList []byte = requiredItemList818
itemMappingLatestPocketMine = mapping.NewItemMapping(requiredItemList818, ItemVersion818)
itemMappingLatestDragonfly = mapping.NewItemMapping(requiredItemList818, ItemVersion818)
itemMappingLatestDragonfly = mapping.NewItemMapping(dragonflyLatestItemList, ItemVersion818)
blockMappingLatest = mapping.NewBlockMapping(blockStateData818)
)
func init() {
var m map[string]struct {
RuntimeID int32 `nbt:"runtime_id"`
ComponentBased bool `nbt:"component_based"`
Version int32 `nbt:"version"`
Data map[string]any `nbt:"data,omitempty"`
}
if err := nbt.Unmarshal(dragonflyLatestVanillaItemsRaw, &m); err != nil {
panic(err)
}
for identifier, v := range m {
itemMappingLatestDragonfly.SetItemRuntimeID(identifier, v.RuntimeID)
}
}
func itemMappingLatest(dragonflyMapping bool) mapping.Item {
if dragonflyMapping {
return itemMappingLatestDragonfly