move self.food check

This commit is contained in:
SumianVoice 2022-07-19 14:23:54 +10:00 committed by cora
parent 9d52fed357
commit 120b096fc8
1 changed files with 18 additions and 18 deletions

View File

@ -4383,26 +4383,23 @@ function mcl_mobs:feed_tame(self, clicker, feed_count, breed, tame, notake)
-- feed and tame -- feed and tame
self.food = (self.food or 0) + 1 if tame then
if self.food >= feed_count then self.tamed = true
if not self.owner or self.owner == "" then
self.food = 0 self.owner = clicker:get_player_name()
if tame then
self.tamed = true
if not self.owner or self.owner == "" then
self.owner = clicker:get_player_name()
consume_food = true
end
end
if breed and not self.child and not consume_food
and self.hornytimer == 0 and not self.horny then
self.horny = true
consume_food = true consume_food = true
end end
-- make sound when fed so many times end
mob_sound(self, "random", true)
if breed and not self.child and not consume_food
and self.hornytimer == 0 and not self.horny then
self.food = (self.food or 0) + 1
consume_food = true
if self.food >= feed_count then
self.food = 0
self.horny = true
end
end end
update_tag(self) update_tag(self)
@ -4426,6 +4423,9 @@ function mcl_mobs:feed_tame(self, clicker, feed_count, breed, tame, notake)
end end
clicker:set_wielded_item(item) clicker:set_wielded_item(item)
else
-- make sound when fed so many times
mob_sound(self, "random", true)
end end
return true return true
end end