From 8147ccd13be96e8d4bec2aae33b8cc8ee84c5866 Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Tue, 15 Oct 2013 17:09:43 +0200 Subject: [PATCH 1/5] Added horse saddling It uses pig code, sorry if it don't works, i'm a noob, but it should work. --- source/Mobs/Horse.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source/Mobs/Horse.cpp b/source/Mobs/Horse.cpp index 46e7969cc..1f2c28adf 100644 --- a/source/Mobs/Horse.cpp +++ b/source/Mobs/Horse.cpp @@ -1,4 +1,3 @@ - #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Horse.h" @@ -107,6 +106,18 @@ void cHorse::OnRightClicked(cPlayer & a_Player) m_TameAttemptTimes++; a_Player.AttachTo(this); + + if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_SADDLE) + { + if (!a_Player.IsGameModeCreative()) + { + a_Player.GetInventory().RemoveOneEquippedItem(); + } + + // Set saddle state & broadcast metadata + m_bIsSaddled = true; + m_World->BroadcastEntityMetadata(*this); + } } From 7d4c0582a8b5768c7ebe9259ac9fe77dc38870d1 Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Tue, 15 Oct 2013 17:11:42 +0200 Subject: [PATCH 2/5] Added extra line --- source/Mobs/Horse.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/Mobs/Horse.cpp b/source/Mobs/Horse.cpp index 1f2c28adf..c2a8f6ed0 100644 --- a/source/Mobs/Horse.cpp +++ b/source/Mobs/Horse.cpp @@ -1,3 +1,4 @@ + #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Horse.h" From fbba2e79eb0ab60e5515a00944313486131c1a35 Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Tue, 15 Oct 2013 17:31:26 +0200 Subject: [PATCH 3/5] Added basic milk code. --- source/Mobs/Cow.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/source/Mobs/Cow.cpp b/source/Mobs/Cow.cpp index 8e9b87d27..38cb30963 100644 --- a/source/Mobs/Cow.cpp +++ b/source/Mobs/Cow.cpp @@ -1,4 +1,3 @@ - #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Cow.h" @@ -7,10 +6,6 @@ -// TODO: Milk Cow - - - cCow::cCow(void) : @@ -28,6 +23,18 @@ void cCow::GetDrops(cItems & a_Drops, cEntity * a_Killer) AddRandomDropItem(a_Drops, 1, 3, IsOnFire() ? E_ITEM_STEAK : E_ITEM_RAW_BEEF); } +void cCow::OnRightClicked(cPlayer & a_Player) +{ + if ((a_Player.GetEquippedItem().m_ItemType == E_ITEM_BUCKET)) + { + if (!a_Player.IsGameModeCreative()) + { + a_Player.GetInventory().RemoveOneEquippedItem(); + a_Player.GetInventory().AddItem(E_ITEM_MILK) + } + + } +} From 06b7e09e7099256598ada53a4cc6e17a5474fb1e Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Tue, 15 Oct 2013 17:32:15 +0200 Subject: [PATCH 4/5] Added extra line (yes, again) --- source/Mobs/Cow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/Mobs/Cow.cpp b/source/Mobs/Cow.cpp index 38cb30963..431a6916d 100644 --- a/source/Mobs/Cow.cpp +++ b/source/Mobs/Cow.cpp @@ -1,3 +1,4 @@ + #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Cow.h" From 400cab0b86476546b4c6a01fa4974c253e58ec8c Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Tue, 15 Oct 2013 18:17:17 +0200 Subject: [PATCH 5/5] Fixed a big fail.I did --- source/Mobs/Cow.h | 1 + 1 file changed, 1 insertion(+) diff --git a/source/Mobs/Cow.h b/source/Mobs/Cow.h index b90cb170e..0391d4a31 100644 --- a/source/Mobs/Cow.h +++ b/source/Mobs/Cow.h @@ -18,6 +18,7 @@ public: CLASS_PROTODEF(cCow); virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; + virtual void OnRightClicked(cPlayer & a_Player) override; } ;