check if bones have an inventory
This commit is contained in:
parent
837055bc20
commit
b777635c6a
@ -11,14 +11,18 @@ type BonesBlock struct{}
|
|||||||
func (this *BonesBlock) onMapObject(x, y, z int, block *mapblockparser.MapBlock) *mapobjectdb.MapObject {
|
func (this *BonesBlock) onMapObject(x, y, z int, block *mapblockparser.MapBlock) *mapobjectdb.MapObject {
|
||||||
md := block.Metadata.GetMetadata(x, y, z)
|
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 := mapobjectdb.NewMapObject(block.Pos, x, y, z, "bones")
|
||||||
o.Attributes["time"] = md["time"]
|
o.Attributes["time"] = md["time"]
|
||||||
o.Attributes["owner"] = md["owner"]
|
o.Attributes["owner"] = md["owner"]
|
||||||
o.Attributes["info"] = md["infotext"]
|
o.Attributes["info"] = md["infotext"]
|
||||||
|
|
||||||
invMap := block.Metadata.GetInventoryMapAtPos(x, y, z)
|
|
||||||
mainInv := invMap["main"]
|
|
||||||
|
|
||||||
itemCount := 0
|
itemCount := 0
|
||||||
for _, item := range mainInv.Items {
|
for _, item := range mainInv.Items {
|
||||||
itemCount += item.Count
|
itemCount += item.Count
|
||||||
|
Loading…
Reference in New Issue
Block a user