Creative inventory has no nbt items
Closed this issue · 1 comments
Flonja commented
Research
What the user sees
What debugging will do
In server/item/creative.go
:
func init() {
var m []creativeItemEntry
if err := nbt.Unmarshal(creativeItemData, &m); err != nil {
panic(err)
}
+ var genericSliceThatShouldntGetMoreAttentionThanItNeeds []any
+ if err := nbt.Unmarshal(creativeItemData, &genericSliceThatShouldntGetMoreAttentionThanItNeeds); err != nil {
+ panic(err)
+ }
+ for i, data := range m {
- for _, data := range m {
if n, ok := it.(world.NBTer); ok {
if len(data.NBT) > 0 {
it = n.DecodeNBT(data.NBT).(world.Item)
}
}
st := item.NewStack(it, 1)
+ if _, ok := it.(item.EnchantedBook); ok {
+ fmt.Printf("%v: %#v\n", i, genericSliceThatShouldntGetMoreAttentionThanItNeeds[i])
+ }
if len(data.NBT) > 0 {
var invalid bool
Will result in:
1452: map[string]interface {}{"meta":0, "name":"minecraft:enchanted_book", "nbt":map[string]interface {}{}}
...
(For the sake of simplicity, I cut all the in between since its all the same anyway...)
...
1561: map[string]interface {}{"meta":0, "name":"minecraft:enchanted_book", "nbt":map[string]interface {}{}}
Clearly there was intended to be nbt there, but it never got assigned(?)
TwistedAsylumMC commented
Fixed in 223f136