From be8d9122eee93e23b3bdb9df27fc126126362bde Mon Sep 17 00:00:00 2001 From: ancientmarinerdev Date: Sun, 7 May 2023 21:11:48 +0100 Subject: [PATCH] Fix crash when creeper explodes in minecart --- mods/ENTITIES/mcl_burning/api.lua | 7 ++++++- mods/ENTITIES/mcl_minecarts/init.lua | 9 +++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/mods/ENTITIES/mcl_burning/api.lua b/mods/ENTITIES/mcl_burning/api.lua index cba73b8460..74c66d5f10 100644 --- a/mods/ENTITIES/mcl_burning/api.lua +++ b/mods/ENTITIES/mcl_burning/api.lua @@ -5,7 +5,12 @@ function mcl_burning.get_storage(obj) end function mcl_burning.is_burning(obj) - return mcl_burning.get_storage(obj).burn_time + local storage = mcl_burning.get_storage(obj) + if storage then + return mcl_burning.get_storage(obj).burn_time + else + return false + end end function mcl_burning.is_affected_by_rain(obj) diff --git a/mods/ENTITIES/mcl_minecarts/init.lua b/mods/ENTITIES/mcl_minecarts/init.lua index 92136c37fc..2d0cd78e97 100644 --- a/mods/ENTITIES/mcl_minecarts/init.lua +++ b/mods/ENTITIES/mcl_minecarts/init.lua @@ -370,13 +370,10 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o end end end - -- Make room in the minecart after the mob dies elseif self._passenger then - if math.random(1,20) == 1 then - local dead = self._passenger:check_for_death() - if dead == true then - self._passenger = nil - end + local passenger_pos = self._passenger.object:get_pos() + if not passenger_pos then + self._passenger = nil end end