From 9416305fa60118d9f4a8d60e823d2ce46901766c Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 10 Sep 2019 17:09:17 +0200 Subject: [PATCH] Fix sheep not regrow wool if mobs_griefing=false --- mods/ENTITIES/mcl_mobs/api.lua | 7 ++++--- mods/ENTITIES/mcl_mobs/api.txt | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 4324aa69d9..0cb272fb2c 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -1101,8 +1101,7 @@ end -- find and replace what mob is looking for (grass, wheat etc.) local replace = function(self, pos) - if not mobs_griefing - or not self.replace_rate + if not self.replace_rate or not self.replace_what or self.child == true or self.object:get_velocity().y ~= 0 @@ -1139,7 +1138,9 @@ local replace = function(self, pos) if on_replace_return ~= false then - minetest.set_node(pos, {name = with}) + if mobs_griefing then + minetest.set_node(pos, {name = with}) + end -- when cow/sheep eats grass, replace wool and milk if self.gotten == true then diff --git a/mods/ENTITIES/mcl_mobs/api.txt b/mods/ENTITIES/mcl_mobs/api.txt index b3e2f03e7c..999ba4a850 100644 --- a/mods/ENTITIES/mcl_mobs/api.txt +++ b/mods/ENTITIES/mcl_mobs/api.txt @@ -243,8 +243,9 @@ eating. 'replace_rate' how random should the replace rate be (typically 10) 'replace_offset' +/- value to check specific node to replace - 'on_replace(self, pos, oldnode, newnode)' is called when mob is about to - replace a node. + 'on_replace(self, pos, oldnode, newnode)' + is called when mob is about to replace a node. Also called + when not actually replacing due to mobs_griefing setting being false. 'self' ObjectRef of mob 'pos' Position of node to replace 'oldnode' Current node