Fix crash on ghast explosions

In certain situations the arrow can be invalidated until its
get_pos() is called here - e.g. when the player wears over-
enchanted blast protection (65k in this case).

This uses the player position for the explosion in these cases
This commit is contained in:
cora 2022-06-19 21:21:49 +02:00
parent 64b8f15f47
commit e3c5b2cbb5
1 changed files with 6 additions and 1 deletions

View File

@ -107,7 +107,12 @@ mcl_mobs:register_arrow("mobs_mc:fireball", {
full_punch_interval = 1.0,
damage_groups = {fleshy = 6},
}, nil)
mcl_mobs:boom(self, self.object:get_pos(), 1, true)
local p = self.object:get_pos()
if p then
mcl_mobs:boom(self, p, 1, true)
else
mcl_mobs:boom(self, player:get_pos(), 1, true)
end
end,
hit_mob = function(self, mob)