1
0
Fork 0

breed by throwing bread at villagers

mobs_head_rotation
cora 2022-05-19 13:58:59 +02:00
parent e6b65af3b4
commit 9a866e873e
1 changed files with 12 additions and 5 deletions

View File

@ -1241,7 +1241,18 @@ mobs:register_mob("mobs_mc:villager", {
look_at_player = true,
pick_up = {"mcl_farming:bread"},
on_pick_up = function(self,itementity)
minetest.log("picked up "..itementity.itemstring)
local clicker
for _,p in pairs(minetest.get_connected_players()) do
if vector.distance(p:get_pos(),self.object:get_pos()) < 10 then
clicker = p
end
end
if not clicker then minetest.log("no clicker") end
if clicker then
mobs:feed_tame(self, clicker, 1, true, true)
return
end
return true --do not pick up
end,
on_rightclick = function(self, clicker)
local trg=vector.new(0,9,0)
@ -1250,10 +1261,6 @@ mobs:register_mob("mobs_mc:villager", {
--minetest.log("arrived at jobsite")
end)
end
if clicker:get_wielded_item():get_name() == "mcl_farming:bread" then
if mobs:feed_tame(self, clicker, 1, true, true) then return end
if mobs:protect(self, clicker) then return end
end
if self.child or self._profession == "unemployed" then
return
end