From 85e531bf106df326b2ca470b5a94aeb06f92d4d6 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Sun, 18 Apr 2021 21:24:31 -0400 Subject: [PATCH] Remove unneeded mobs:protect from code --- mods/ENTITIES/extra_mobs/strider.lua | 1 - mods/ENTITIES/mcl_mobs/api.txt | 13 ------------- .../mcl_mobs/api/mob_functions/backup_code_api.lua | 5 ----- mods/ENTITIES/mobs_mc/chicken.lua | 1 - mods/ENTITIES/mobs_mc/cow+mooshroom.lua | 2 -- mods/ENTITIES/mobs_mc/horse.lua | 6 +----- mods/ENTITIES/mobs_mc/llama.lua | 3 +-- mods/ENTITIES/mobs_mc/ocelot.lua | 1 - mods/ENTITIES/mobs_mc/parrot.lua | 1 - mods/ENTITIES/mobs_mc/pig.lua | 1 - mods/ENTITIES/mobs_mc/rabbit.lua | 1 - mods/ENTITIES/mobs_mc/sheep.lua | 1 - mods/ENTITIES/mobs_mc/wolf.lua | 4 +--- 13 files changed, 3 insertions(+), 37 deletions(-) diff --git a/mods/ENTITIES/extra_mobs/strider.lua b/mods/ENTITIES/extra_mobs/strider.lua index 6796bdca2..d6c854207 100644 --- a/mods/ENTITIES/extra_mobs/strider.lua +++ b/mods/ENTITIES/extra_mobs/strider.lua @@ -124,7 +124,6 @@ local strider = { if wielditem:get_name() ~= controlitem then if mobs:feed_tame(self, clicker, 1, true, true) then return end end - if mobs:protect(self, clicker) then return end if self.child then return diff --git a/mods/ENTITIES/mcl_mobs/api.txt b/mods/ENTITIES/mcl_mobs/api.txt index 0e4810b0f..5d49ca7ef 100644 --- a/mods/ENTITIES/mcl_mobs/api.txt +++ b/mods/ENTITIES/mcl_mobs/api.txt @@ -521,19 +521,6 @@ Will return true when mob is fed with item it likes. them up -Protecting Mobs ---------------- - -mobs:protect(self, clicker) - -This function can be used to right-click any tamed mob with mobs:protector item, -this will protect the mob from harm inside of a protected area from other -players. Will return true when mob right-clicked with mobs:protector item. - - 'self' mob information - 'clicker' player information - - Riding Mobs ----------- diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/backup_code_api.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/backup_code_api.lua index d7b229147..2c1ba1983 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/backup_code_api.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/backup_code_api.lua @@ -112,11 +112,6 @@ function mobs:spawn_child(pos, mob_type) end --- No-op in MCL2 (protecting mobs is not possible). -function mobs:protect(self, clicker) - return false -end - -- feeding, taming and breeding (thanks blert2112) function mobs:feed_tame(self, clicker, feed_count, breed, tame) diff --git a/mods/ENTITIES/mobs_mc/chicken.lua b/mods/ENTITIES/mobs_mc/chicken.lua index 3d7ba8606..2fe82293e 100644 --- a/mods/ENTITIES/mobs_mc/chicken.lua +++ b/mods/ENTITIES/mobs_mc/chicken.lua @@ -69,7 +69,6 @@ mobs:register_mob("mobs_mc:chicken", { on_rightclick = function(self, clicker) if mobs:feed_tame(self, clicker, 1, true, true) then return end - if mobs:protect(self, clicker) then return end end, do_custom = function(self, dtime) diff --git a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua index 9ad7b2a18..59b80ecb9 100644 --- a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua +++ b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua @@ -50,7 +50,6 @@ local cow_def = { follow = mobs_mc.follow.cow, on_rightclick = function(self, clicker) if mobs:feed_tame(self, clicker, 1, true, true) then return end - if mobs:protect(self, clicker) then return end if self.child then return @@ -86,7 +85,6 @@ mooshroom_def.mesh = "mobs_mc_cow.b3d" mooshroom_def.textures = { {"mobs_mc_mooshroom.png", "mobs_mc_mushroom_red.png"}, {"mobs_mc_mooshroom_brown.png", "mobs_mc_mushroom_brown.png" } } mooshroom_def.on_rightclick = function(self, clicker) if mobs:feed_tame(self, clicker, 1, true, true) then return end - if mobs:protect(self, clicker) then return end if self.child then return diff --git a/mods/ENTITIES/mobs_mc/horse.lua b/mods/ENTITIES/mobs_mc/horse.lua index b9d79a075..0e0246d4e 100644 --- a/mods/ENTITIES/mobs_mc/horse.lua +++ b/mods/ENTITIES/mobs_mc/horse.lua @@ -281,10 +281,6 @@ local horse = { return end - if mobs:protect(self, clicker) then - return - end - -- Make sure tamed horse is mature and being clicked by owner only if self.tamed and not self.child and self.owner == clicker:get_player_name() then @@ -355,7 +351,7 @@ local horse = { self.object:set_properties({stepheight = 1.1}) mobs.attach(self, clicker) - + end end end, diff --git a/mods/ENTITIES/mobs_mc/llama.lua b/mods/ENTITIES/mobs_mc/llama.lua index 5951f9dff..e0c353ad8 100644 --- a/mods/ENTITIES/mobs_mc/llama.lua +++ b/mods/ENTITIES/mobs_mc/llama.lua @@ -133,7 +133,6 @@ mobs:register_mob("mobs_mc:llama", { -- Feed with anything else if mobs:feed_tame(self, clicker, 1, false, true) then return end end - if mobs:protect(self, clicker) then return end -- Make sure tamed llama is mature and being clicked by owner only if self.tamed and not self.child and self.owner == clicker:get_player_name() then @@ -182,7 +181,7 @@ mobs:register_mob("mobs_mc:llama", { self.object:set_properties({stepheight = 1.1}) mobs.attach(self, clicker) end - + end end, diff --git a/mods/ENTITIES/mobs_mc/ocelot.lua b/mods/ENTITIES/mobs_mc/ocelot.lua index 139b68785..bb62a54fa 100644 --- a/mods/ENTITIES/mobs_mc/ocelot.lua +++ b/mods/ENTITIES/mobs_mc/ocelot.lua @@ -121,7 +121,6 @@ cat.sounds = { } cat.on_rightclick = function(self, clicker) if mobs:feed_tame(self, clicker, 1, true, false) then return end - if mobs:protect(self, clicker) then return end if self.child then return end diff --git a/mods/ENTITIES/mobs_mc/parrot.lua b/mods/ENTITIES/mobs_mc/parrot.lua index 06a2dc18b..ef82884aa 100644 --- a/mods/ENTITIES/mobs_mc/parrot.lua +++ b/mods/ENTITIES/mobs_mc/parrot.lua @@ -85,7 +85,6 @@ mobs:register_mob("mobs_mc:parrot", { -- Feed to tame, but not breed if mobs:feed_tame(self, clicker, 1, false, true) then return end - if mobs:protect(self, clicker) then return end end, }) diff --git a/mods/ENTITIES/mobs_mc/pig.lua b/mods/ENTITIES/mobs_mc/pig.lua index da7e686ad..2751a8beb 100644 --- a/mods/ENTITIES/mobs_mc/pig.lua +++ b/mods/ENTITIES/mobs_mc/pig.lua @@ -95,7 +95,6 @@ mobs:register_mob("mobs_mc:pig", { if wielditem:get_name() ~= mobs_mc.items.carrot_on_a_stick then if mobs:feed_tame(self, clicker, 1, true, true) then return end end - if mobs:protect(self, clicker) then return end if self.child then return diff --git a/mods/ENTITIES/mobs_mc/rabbit.lua b/mods/ENTITIES/mobs_mc/rabbit.lua index 0f67bb7d7..a7d5d02d9 100644 --- a/mods/ENTITIES/mobs_mc/rabbit.lua +++ b/mods/ENTITIES/mobs_mc/rabbit.lua @@ -61,7 +61,6 @@ local rabbit = { on_rightclick = function(self, clicker) -- Feed, tame protect or capture if mobs:feed_tame(self, clicker, 1, true, true) then return end - if mobs:protect(self, clicker) then return end end, do_custom = function(self) -- Easter egg: Change texture if rabbit is named “Toast” diff --git a/mods/ENTITIES/mobs_mc/sheep.lua b/mods/ENTITIES/mobs_mc/sheep.lua index 8ba8aecd8..e6368a3f8 100644 --- a/mods/ENTITIES/mobs_mc/sheep.lua +++ b/mods/ENTITIES/mobs_mc/sheep.lua @@ -195,7 +195,6 @@ mobs:register_mob("mobs_mc:sheep", { local item = clicker:get_wielded_item() if mobs:feed_tame(self, clicker, 1, true, true) then return end - if mobs:protect(self, clicker) then return end if item:get_name() == mobs_mc.items.shears and not self.gotten and not self.child then self.gotten = true diff --git a/mods/ENTITIES/mobs_mc/wolf.lua b/mods/ENTITIES/mobs_mc/wolf.lua index 319a4f959..00a41b685 100644 --- a/mods/ENTITIES/mobs_mc/wolf.lua +++ b/mods/ENTITIES/mobs_mc/wolf.lua @@ -147,9 +147,7 @@ dog.specific_attack = nil dog.on_rightclick = function(self, clicker) local item = clicker:get_wielded_item() - if mobs:protect(self, clicker) then - return - elseif is_food(item:get_name()) then + if is_food(item:get_name()) then -- Feed to increase health local hp = self.health local hp_add = 0