From 8cb73ee509816a1a1a17374372234fb25072fd4f Mon Sep 17 00:00:00 2001 From: cora Date: Thu, 13 Oct 2022 19:37:11 +0200 Subject: [PATCH] Fix on_pick_up api accepts a returned itemstring from the callback now --- mods/ENTITIES/mcl_mobs/api.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 535bea0d1..435ee3cb4 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -3133,7 +3133,12 @@ local function check_item_pickup(self) if l and l.name == "__builtin:item" 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 - if self.on_pick_up(self,l) == nil then o:remove() end + local r = self.on_pick_up(self,l) + if r then + l.itemstring = r:to_string() + else + o:remove() + end end end end