df-mc / dragonfly

Minecraft Bedrock Edition server software written in Go
https://discord.gg/U4kFWHhTNR
MIT License
678 stars 140 forks source link

Error loading world with new gophertunnel version #647

Closed AndreasHGK closed 2 years ago

AndreasHGK commented 2 years ago

I just updated schematic to 1.0.4 and got the following error while starting my server

panic: reflect: call of reflect.Value.SetUint on bool Value

goroutine 1 [running]:
reflect.Value.SetUint({0x915800?, 0xc000d3aa38?, 0x16629fd00d4?}, 0x0)
        C:/Program Files/Go/src/reflect/value.go:2334 +0xef
github.com/sandertv/gophertunnel/minecraft/nbt.(*Decoder).unmarshalTag(0xc000527840, {0x915800?, 0xc000d3aa38?, 0x1e?}, 0x1, {0xc00267b120, 0x1e})
        C:/Users/andre/go/pkg/mod/github.com/sandertv/gophertunnel@v1.24.1/minecraft/nbt/decode.go:121 +0x328
github.com/sandertv/gophertunnel/minecraft/nbt.(*Decoder).unmarshalTag(0xc000527840, {0xa5c240?, 0xc000d3aa18?, 0xc0004f40a0?}, 0xa, {0x1efe040, 0x0})
        C:/Users/andre/go/pkg/mod/github.com/sandertv/gophertunnel@v1.24.1/minecraft/nbt/decode.go:371 +0x3265
github.com/sandertv/gophertunnel/minecraft/nbt.(*Decoder).Decode(0xc00007c150?, {0x904a80?, 0xc000d3aa18?})
        C:/Users/andre/go/pkg/mod/github.com/sandertv/gophertunnel@v1.24.1/minecraft/nbt/decode.go:44 +0x19f
github.com/sandertv/gophertunnel/minecraft/nbt.UnmarshalEncoding({0xc002686a88, 0x906, 0x907}, {0x904a80, 0xc000d3aa18}, {0xf2fd30, 0x1efe040})
        C:/Users/andre/go/pkg/mod/github.com/sandertv/gophertunnel@v1.24.1/minecraft/nbt/decode.go:86 +0x1c5
github.com/df-mc/dragonfly/server/world/mcdb.New({0xa69981, 0xe}, 0x4)
        C:/Users/andre/go/pkg/mod/github.com/df-mc/dragonfly@v0.8.1/server/world/mcdb/provider.go:57 +0x234
github.com/df-mc/dragonfly/server.New(0xc0006228f0, {0xf27140?, 0xc0000d2080?})
        C:/Users/andre/go/pkg/mod/github.com/df-mc/dragonfly@v0.8.1/server/server.go:120 +0x5df
main.main()
        C:/Users/andre/go/src/akuro/prisons/main.go:77 +0x1ea
exit status 2
AndreasHGK commented 2 years ago

gophertunnel@v1.24.1/minecraft/nbt/decode.go Line 118-121

case k == reflect.Uint8:
    val.SetBool(value == 1)
case k == reflect.Bool:
    val.SetUint(uint64(value))

When changing it to

case k == reflect.Bool:
    val.SetBool(value == 1)
case k == reflect.Uint8:
    val.SetUint(uint64(value))

I get another error:

panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/sandertv/gophertunnel/minecraft/nbt.littleEndian.Int32Slice({}, 0xc000597380)
        C:/Users/andre/go/pkg/mod/github.com/sandertv/gophertunnel@v1.24.1/minecraft/nbt/encoding_little_endian.go:143 +0x175
github.com/sandertv/gophertunnel/minecraft/nbt.(*Decoder).unmarshalTag(0xc0005c5840, {0xb12300?, 0xc000d62ab0?, 0x1e?}, 0x9, {0xc002136f20, 0x1e})
        C:/Users/andre/go/pkg/mod/github.com/sandertv/gophertunnel@v1.24.1/minecraft/nbt/decode.go:306 +0x1d22
github.com/sandertv/gophertunnel/minecraft/nbt.(*Decoder).unmarshalTag(0xc0005c5840, {0xc5c240?, 0xc000d62a18?, 0xc00000a0b8?}, 0xa, {0x20fe040, 0x0})
        C:/Users/andre/go/pkg/mod/github.com/sandertv/gophertunnel@v1.24.1/minecraft/nbt/decode.go:371 +0x3265
github.com/sandertv/gophertunnel/minecraft/nbt.(*Decoder).Decode(0xc000108120?, {0xb04a80?, 0xc000d62a18?})
        C:/Users/andre/go/pkg/mod/github.com/sandertv/gophertunnel@v1.24.1/minecraft/nbt/decode.go:44 +0x19f
github.com/sandertv/gophertunnel/minecraft/nbt.UnmarshalEncoding({0xc002664a88, 0x906, 0x907}, {0xb04a80, 0xc000d62a18}, {0x112fd30, 0x20fe040})
        C:/Users/andre/go/pkg/mod/github.com/sandertv/gophertunnel@v1.24.1/minecraft/nbt/decode.go:86 +0x1c5
github.com/df-mc/dragonfly/server/world/mcdb.New({0xc69981, 0xe}, 0x4)
        C:/Users/andre/go/pkg/mod/github.com/df-mc/dragonfly@v0.8.1/server/world/mcdb/provider.go:57 +0x234
github.com/df-mc/dragonfly/server.New(0xc00004f380, {0x1127140?, 0xc000172080?})
        C:/Users/andre/go/pkg/mod/github.com/df-mc/dragonfly@v0.8.1/server/server.go:120 +0x5df
main.main()
        C:/Users/andre/go/src/akuro/prisons/main.go:77 +0x1ea
exit status 2