mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-24 11:53:46 +01:00
Stop villagers from eating shulker boxes (#4266)
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 <rudzik8@protonmail.com> Co-authored-by: teknomunk <teknomunk@protonmail.com> Co-committed-by: teknomunk <teknomunk@protonmail.com>
This commit is contained in:
parent
22c4daab22
commit
0c372f987d
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user