From a329c9561c729c60760fa601dc94c168f53deeb8 Mon Sep 17 00:00:00 2001 From: sqmatheus Date: Tue, 31 Oct 2023 16:08:06 -0300 Subject: [PATCH] block/decorated_pot.go: Use nbtconv.Slice() to get the sherds --- server/block/decorated_pot.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/block/decorated_pot.go b/server/block/decorated_pot.go index 0454b3360..4ed099d48 100644 --- a/server/block/decorated_pot.go +++ b/server/block/decorated_pot.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/df-mc/dragonfly/server/block/cube" "github.com/df-mc/dragonfly/server/block/model" + "github.com/df-mc/dragonfly/server/internal/nbtconv" "github.com/df-mc/dragonfly/server/item" "github.com/df-mc/dragonfly/server/world" "github.com/go-gl/mathgl/mgl64" @@ -82,8 +83,8 @@ func (p DecoratedPot) EncodeNBT() map[string]any { // DecodeNBT ... func (p DecoratedPot) DecodeNBT(data map[string]any) any { p.Decorations = [4]PotDecoration{} - if sherds, ok := data["sherds"]; ok { - for i, name := range sherds.([]any) { + if sherds := nbtconv.Slice(data, "sherds"); sherds != nil { + for i, name := range sherds { it, ok := world.ItemByName(name.(string), 0) if !ok { panic(fmt.Errorf("unknown item %s", name))