From 0c372f987dacf6e19273b7e5e7e663411de9c086 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 1 May 2024 15:44:14 +0000 Subject: [PATCH] Stop villagers from eating shulker boxes (#4266) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This modifies the logic for mobs picking up items to only match against the item's name and ignore any text in an items metadata. Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/4266 Reviewed-by: Mikita Wiśniewski Co-authored-by: teknomunk Co-committed-by: teknomunk --- mods/ENTITIES/mcl_mobs/items.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/items.lua b/mods/ENTITIES/mcl_mobs/items.lua index 267dd8595..f2ec4dedd 100644 --- a/mods/ENTITIES/mcl_mobs/items.lua +++ b/mods/ENTITIES/mcl_mobs/items.lua @@ -87,7 +87,8 @@ function mob_class:check_item_pickup() end if self.pick_up then for k,v in pairs(self.pick_up) do - if not player_near(p) and self.on_pick_up and l.itemstring:find(v) then + local itemstack = ItemStack(l.itemstring) + if not player_near(p) and self.on_pick_up and itemstack:get_name():find(v) then local r = self.on_pick_up(self,l) if r and r.is_empty and not r:is_empty() then l.itemstring = r:to_string()