From 4bc5320f95331ab8b5ceb9a5ab4bde473f9d66a7 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 1 Feb 2017 17:06:31 +0100 Subject: [PATCH] Add carrot on a stick --- mods/mcl_mobitems/init.lua | 23 ++++++++++++++++++ .../mcl_mobitems_carrot_on_a_stick.png | Bin 0 -> 366 bytes mods/mobs_mc/pig.lua | 15 ++++++------ 3 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 mods/mcl_mobitems/textures/mcl_mobitems_carrot_on_a_stick.png diff --git a/mods/mcl_mobitems/init.lua b/mods/mcl_mobitems/init.lua index 7b1a2761c..139c421e9 100644 --- a/mods/mcl_mobitems/init.lua +++ b/mods/mcl_mobitems/init.lua @@ -208,6 +208,13 @@ minetest.register_craftitem("mcl_mobitems:rabbit_stew", { groups = { food = 3, eatable = 10 }, }) +minetest.register_tool("mcl_mobitems:carrot_on_a_stick", { + description = "Carrot on a Stick", + wield_image = "mcl_mobitems_carrot_on_a_stick.png", + inventory_image = "mcl_mobitems_carrot_on_a_stick.png", + groups = { transport = 1 }, +}) + ----------- -- Crafting ----------- @@ -234,6 +241,22 @@ minetest.register_craft({ }, }) +minetest.register_craft({ + output = "mcl_mobitems:carrot_on_a_stick", + recipe = { + { "mcl_fishing:fishing_rod", "", }, + { "", "mcl_farming:carrot_item" }, + }, +}) + +minetest.register_craft({ + output = "mcl_mobitems:carrot_on_a_stick", + recipe = { + { "", "mcl_fishing:fishing_rod", }, + { "mcl_farming:carrot_item", "" }, + }, +}) + minetest.register_craft({ type = "shapeless", output = "mcl_mobitems:magma_cream", diff --git a/mods/mcl_mobitems/textures/mcl_mobitems_carrot_on_a_stick.png b/mods/mcl_mobitems/textures/mcl_mobitems_carrot_on_a_stick.png new file mode 100644 index 0000000000000000000000000000000000000000..44eb55fc574e6c83cf8cf254af1cb3dcb21a6c0a GIT binary patch literal 366 zcmV-!0g?WRP)NleqK>4i1V}@jy>rAW$AjnxuW{;_we0 z!uK_QlBNOx#E=nxftav7&jB-t0D_C{Or|Lj6@J>MGV62{Pk_Rs3MlxsTFEGQlnN*u zqu!idpgHXn&Mwf_IjcZ(+D&ja0bA$n0&ShM3b=I6Cg9pRi-1q(y$f`KcNUi_@% literal 0 HcmV?d00001 diff --git a/mods/mobs_mc/pig.lua b/mods/mobs_mc/pig.lua index b6333cf3e..202c5a61b 100644 --- a/mods/mobs_mc/pig.lua +++ b/mods/mobs_mc/pig.lua @@ -89,26 +89,25 @@ mobs:register_mob("mobs_mc:pig", { if self.driver and clicker == self.driver then self.driver = nil clicker:set_detach() - default.player_attached[name] = false - default.player_set_animation(clicker, "stand" , 30) + mcl_core.player_attached[name] = false + mcl_core.player_set_animation(clicker, "stand" , 30) elseif not self.driver and self.saddle == "yes" then self.driver = clicker clicker:set_attach(self.object, "", {x = 0, y = 19, z = 0}, {x = 0, y = 0, z = 0}) - default.player_attached[name] = true + mcl_core.player_attached[name] = true minetest.after(0.2, function() - default.player_set_animation(clicker, "sit" , 30) + mcl_core.player_set_animation(clicker, "sit" , 30) end) ----[[ -- ridable pigs - if self.name == "mobs:pig" and self.saddle == "yes" and self.driver then + if self.name == "mobs_mc:pig" and self.saddle == "yes" and self.driver then local item = self.driver:get_wielded_item() - if item:get_name() == "mobs:carrotstick" then + if item:get_name() == "mcl_mobitems:carrot_on_a_stick" then local yaw = self.driver:get_look_yaw() - math.pi / 2 local velo = self.object:getvelocity() local v = 1.5 if math.abs(velo.x) + math.abs(velo.z) < .6 then velo.y = 5 end self.state = "walk" - self:set_animation("walk") self.object:setyaw(yaw) self.object:setvelocity({x = -math.sin(yaw) * v, y = velo.y, z = math.cos(yaw) * v}) @@ -116,7 +115,7 @@ mobs:register_mob("mobs_mc:pig", { local stack = inv:get_stack("main", self.driver:get_wield_index()) stack:add_wear(100) if stack:get_wear() > 65400 then - stack = {name = "fishing:pole", count = 1} + stack = {name = "mcl_fishing:fishing_rod", count = 1} end inv:set_stack("main", self.driver:get_wield_index(), stack) return