1
0
Fork 0

make villager item pickup use new api feature

This commit is contained in:
cora 2022-10-14 01:36:10 +02:00 committed by PrairieWind
parent 1ac0da335a
commit bb640b4f1c
1 changed files with 4 additions and 3 deletions

View File

@ -1286,16 +1286,17 @@ mcl_mobs:register_mob("mobs_mc:villager", {
can_open_doors = true, can_open_doors = true,
on_pick_up = function(self,itementity) on_pick_up = function(self,itementity)
local clicker local clicker
local it = ItemStack(itementity.itemstring)
for _,p in pairs(minetest.get_connected_players()) do for _,p in pairs(minetest.get_connected_players()) do
if vector.distance(p:get_pos(),self.object:get_pos()) < 10 then if vector.distance(p:get_pos(),self.object:get_pos()) < 10 then
clicker = p clicker = p
end end
end end
if clicker then if clicker and not self.horny then
mcl_mobs:feed_tame(self, clicker, 1, true, false, true) mcl_mobs:feed_tame(self, clicker, 1, true, false, true)
return it:take_item(1)
end end
return true --do not pick up return it
end, end,
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
if self._jobsite then if self._jobsite then