From e7e8d394ed175a149bf797495aea0e39663586fd Mon Sep 17 00:00:00 2001 From: kay27 Date: Sat, 25 Dec 2021 04:49:12 +0400 Subject: [PATCH] #55 Rewrite boat get_visual_size in a bit safer way --- mods/ENTITIES/mcl_boats/init.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_boats/init.lua b/mods/ENTITIES/mcl_boats/init.lua index beff5fb52..a7ca7edde 100644 --- a/mods/ENTITIES/mcl_boats/init.lua +++ b/mods/ENTITIES/mcl_boats/init.lua @@ -41,7 +41,14 @@ local function check_object(obj) end local function get_visual_size(obj) - return obj:is_player() and {x = 1, y = 1, z = 1} or obj:get_luaentity()._old_visual_size or obj:get_properties().visual_size + if not obj or obj:is_player() then + return boat_visual_size + end + local luaentity = obj:get_luaentity() + if luaentity then + return luaentity._old_visual_size + end + return obj:get_properties().visual_size end local function set_attach(boat)