Fix possible crash when spawning piglin

This commit is contained in:
cora 2022-10-15 00:13:54 +02:00 committed by PrairieWind
parent d13d50333f
commit 88de3656b1
1 changed files with 1 additions and 2 deletions

View File

@ -119,8 +119,7 @@ local piglin = {
on_pick_up = function(self, itementity)
local item = itementity.itemstring:split(" ")[1]
local it = ItemStack(itementity.itemstring)
--return true --do not pick up
if item == "mcl_core:gold_ingot" and self.state ~= "attack" and self.gold_items < 3 then
if item == "mcl_core:gold_ingot" and self.state ~= "attack" and self.gold_items and self.gold_items < 3 then
it:take_item(1)
self.state = "stand"
self.object:set_animation({x=0,y=79})