From b777635c6a11396a594130be2c29ac71462664ed Mon Sep 17 00:00:00 2001 From: Thomas Rudin Date: Thu, 12 Dec 2019 22:11:20 +0100 Subject: [PATCH] check if bones have an inventory --- mapobject/bones.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mapobject/bones.go b/mapobject/bones.go index aba6d19..232d452 100644 --- a/mapobject/bones.go +++ b/mapobject/bones.go @@ -11,14 +11,18 @@ type BonesBlock struct{} func (this *BonesBlock) onMapObject(x, y, z int, block *mapblockparser.MapBlock) *mapobjectdb.MapObject { md := block.Metadata.GetMetadata(x, y, z) + invMap := block.Metadata.GetInventoryMapAtPos(x, y, z) + mainInv := invMap["main"] + + if mainInv == nil { + return nil + } + o := mapobjectdb.NewMapObject(block.Pos, x, y, z, "bones") o.Attributes["time"] = md["time"] o.Attributes["owner"] = md["owner"] o.Attributes["info"] = md["infotext"] - invMap := block.Metadata.GetInventoryMapAtPos(x, y, z) - mainInv := invMap["main"] - itemCount := 0 for _, item := range mainInv.Items { itemCount += item.Count