From 4bc5320f95331ab8b5ceb9a5ab4bde473f9d66a7 Mon Sep 17 00:00:00 2001
From: Wuzzy <almikes@aol.com>
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 7b1a2761..139c421e 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
zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4mJh`hT^KKFANNfrk*a2ArXh)PB-K_WFXSU
zEbCe#D7bL7+yN`=l9!JZ;ueP3w631K;|mubUsw1?2md&Q06EWDOKM*}`oJ%H=(}nC
zq-9JDM<xi?H_q5#bDq(-gQ2PWt<N$|LD9Nf%Z*-_i1;@gTFj;KV{6n&jfyE;8ZwLT
z&52!L`Bvnd-i2$Hs~w7O`4*TlMn8YUlsk7b*N&2NY7cH%b~pGx-^*RnST43;Zh2!h
zcZ<%BIMx#RY1<4vr#5iDQ+4=WIW5&lkE#2%Oi4jH<E_fr>qe=OQL1+Cj2aCy<J1zF
zwiL658*(bhyz{Pj_eLmguJRdIhl7UqKTAB>{C;i3_Va>mm-AL1V9yiTAZwKM@uiqz
z>wbQwJ^#6#_-6`KtZvZ$6WVgHS5(1*ZO`=I2a=UlB$}i3e(hJ}N_gVK((|8DA@9eb
V-A@*ZGB7YOc)I$ztaD0e0ssSUlj{Hg

literal 0
HcmV?d00001

diff --git a/mods/mobs_mc/pig.lua b/mods/mobs_mc/pig.lua
index b6333cf3..202c5a61 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