From 8c64fdfa5db0cef33f7bf9c70444810825d9e1d0 Mon Sep 17 00:00:00 2001 From: codiac Date: Sun, 13 Aug 2023 14:02:15 +1000 Subject: [PATCH] Enable enchanting on sheers & allow enchanted shears to shear. --- mods/ENTITIES/mobs_mc/cow+mooshroom.lua | 2 +- mods/ENTITIES/mobs_mc/sheep.lua | 2 +- mods/ENTITIES/mobs_mc/snowman.lua | 2 +- mods/ITEMS/mcl_beehives/init.lua | 2 +- mods/ITEMS/mcl_tools/init.lua | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua index 64f74c516..9d1aa1aaa 100644 --- a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua +++ b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua @@ -105,7 +105,7 @@ mooshroom_def.on_rightclick = function(self, clicker) end local item = clicker:get_wielded_item() -- Use shears to get mushrooms and turn mooshroom into cow - if item:get_name() == "mcl_tools:shears" then + if minetest.get_item_group(item:get_name(), "shears") > 0 then local pos = self.object:get_pos() minetest.sound_play("mcl_tools_shears_cut", {pos = pos}, true) diff --git a/mods/ENTITIES/mobs_mc/sheep.lua b/mods/ENTITIES/mobs_mc/sheep.lua index 6eaffa611..af1222403 100644 --- a/mods/ENTITIES/mobs_mc/sheep.lua +++ b/mods/ENTITIES/mobs_mc/sheep.lua @@ -234,7 +234,7 @@ mcl_mobs.register_mob("mobs_mc:sheep", { if self:feed_tame(clicker, 1, true, false) then return end if mcl_mobs:protect(self, clicker) then return end - if item:get_name() == "mcl_tools:shears" and not self.gotten and not self.child then + if minetest.get_item_group(item:get_name(), "shears") > 0 and not self.gotten and not self.child then self.gotten = true local pos = self.object:get_pos() minetest.sound_play("mcl_tools_shears_cut", {pos = pos}, true) diff --git a/mods/ENTITIES/mobs_mc/snowman.lua b/mods/ENTITIES/mobs_mc/snowman.lua index ec2a14675..0e5bc8d4b 100644 --- a/mods/ENTITIES/mobs_mc/snowman.lua +++ b/mods/ENTITIES/mobs_mc/snowman.lua @@ -114,7 +114,7 @@ mcl_mobs.register_mob("mobs_mc:snowman", { -- Remove pumpkin if using shears on_rightclick = function(self, clicker) local item = clicker:get_wielded_item() - if self.gotten ~= true and item:get_name() == "mcl_tools:shears" then + if self.gotten ~= true and inetest.get_item_group(item:get_name(), "shears") > 0 then -- Remove pumpkin self.gotten = true self.object:set_properties({ diff --git a/mods/ITEMS/mcl_beehives/init.lua b/mods/ITEMS/mcl_beehives/init.lua index 82b3cae5f..d20370ca7 100644 --- a/mods/ITEMS/mcl_beehives/init.lua +++ b/mods/ITEMS/mcl_beehives/init.lua @@ -8,7 +8,7 @@ local S = minetest.get_translator(minetest.get_current_modname()) -- Function to allow harvesting honey and honeycomb from the beehive and bee nest. local honey_harvest = function(pos, node, player, itemstack, pointed_thing) local inv = player:get_inventory() - local shears = player:get_wielded_item():get_name() == "mcl_tools:shears" + local shears = minetest.get_item_group(player:get_wielded_item():get_name(), "shears") > 0 local bottle = player:get_wielded_item():get_name() == "mcl_potions:glass_bottle" local beehive = "mcl_beehives:beehive" local is_creative = minetest.is_creative_enabled(player:get_player_name()) diff --git a/mods/ITEMS/mcl_tools/init.lua b/mods/ITEMS/mcl_tools/init.lua index 5f96fa3fa..2c17aa135 100644 --- a/mods/ITEMS/mcl_tools/init.lua +++ b/mods/ITEMS/mcl_tools/init.lua @@ -661,7 +661,7 @@ minetest.register_tool("mcl_tools:shears", { inventory_image = "default_tool_shears.png", wield_image = "default_tool_shears.png", stack_max = 1, - groups = { tool=1, shears=1, dig_speed_class=4, }, + groups = { tool=1, shears=1, dig_speed_class=4, enchantability=14, }, tool_capabilities = { full_punch_interval = 0.5, max_drop_level=1,