From 995024b47bc2c79b272cc6f2d8ab411fbef9a8de Mon Sep 17 00:00:00 2001 From: Nicholas Niro Date: Fri, 30 Aug 2019 04:31:14 +0200 Subject: [PATCH] Teach mobs not to jump if they'd hurt their head --- mods/ENTITIES/mcl_mobs/api.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index b7a8e22f3..c5cacd923 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -781,6 +781,19 @@ local do_jump = function(self) z = pos.z + dir_z }) + -- this is used to detect if there's a block on top of the block in front of the mob. + -- If there is, there is no point in jumping as we won't manage. + local nodTop = node_ok({ + x = pos.x + dir_x, + y = pos.y + 1.5, + z = pos.z + dir_z + }) + + -- we don't attempt to jump if there's a stack of blocks blocking + if nodTop ~= nil then + return false + end + -- thin blocks that do not need to be jumped if nod.name == node_snow then return false