summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSTRWarrior <niels.breuker@hotmail.nl>2013-11-10 20:12:30 +0100
committerSTRWarrior <niels.breuker@hotmail.nl>2013-11-10 20:12:30 +0100
commite62858ec3d027de8c5c4605913ab6261ec19d624 (patch)
treed1e3427af68ac13f35af69bf53bff2005a21e664
parentThe owner object isn't stored anymore. Instead we use the name of the player. (diff)
downloadcuberite-e62858ec3d027de8c5c4605913ab6261ec19d624.tar
cuberite-e62858ec3d027de8c5c4605913ab6261ec19d624.tar.gz
cuberite-e62858ec3d027de8c5c4605913ab6261ec19d624.tar.bz2
cuberite-e62858ec3d027de8c5c4605913ab6261ec19d624.tar.lz
cuberite-e62858ec3d027de8c5c4605913ab6261ec19d624.tar.xz
cuberite-e62858ec3d027de8c5c4605913ab6261ec19d624.tar.zst
cuberite-e62858ec3d027de8c5c4605913ab6261ec19d624.zip
Diffstat (limited to '')
-rw-r--r--source/Mobs/Wolf.cpp15
-rw-r--r--source/Mobs/Wolf.h10
-rw-r--r--source/Protocol/Protocol17x.cpp2
3 files changed, 20 insertions, 7 deletions
diff --git a/source/Mobs/Wolf.cpp b/source/Mobs/Wolf.cpp
index 6d1c5565c..9880a3442 100644
--- a/source/Mobs/Wolf.cpp
+++ b/source/Mobs/Wolf.cpp
@@ -16,7 +16,8 @@ cWolf::cWolf(void) :
m_bIsTame(false),
m_bIsSitting(false),
m_bIsBegging(false),
- m_bOwner("")
+ m_bOwner(""),
+ m_bCollar(14)
{
}
@@ -66,7 +67,15 @@ void cWolf::OnRightClicked(cPlayer & a_Player)
{
if (a_Player.GetName() == m_bOwner) // Is the player the owner of the dog?
{
- if (IsSitting())
+ if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_DYE)
+ {
+ m_bCollar = 15 - a_Player.GetEquippedItem().m_ItemDamage;
+ if (!a_Player.IsGameModeCreative())
+ {
+ a_Player.GetInventory().RemoveOneEquippedItem();
+ }
+ }
+ else if (IsSitting())
{
SetIsSitting(false);
}
@@ -144,7 +153,7 @@ void cWolf::Tick(float a_Dt, cChunk & a_Chunk)
Vector3f OwnerCoords;
} ;
cCallback Callback;
- m_World->FindAndDoWithPlayer(m_bOwner, Callback);
+ m_World->DoWithPlayer(m_bOwner, Callback);
Vector3f OwnerCoords = Callback.OwnerCoords;
if (IsTame())
diff --git a/source/Mobs/Wolf.h b/source/Mobs/Wolf.h
index fb6bb2355..2afca8086 100644
--- a/source/Mobs/Wolf.h
+++ b/source/Mobs/Wolf.h
@@ -28,6 +28,7 @@ public:
bool IsBegging(void) const { return m_bIsBegging; }
bool IsAngry(void) const { return m_bIsAngry; }
AString GetOwner(void) const { return m_bOwner; }
+ int GetCollarColor(void) const { return m_bCollar; }
// Set functions
void SetIsSitting(bool a_IsSitting) { m_bIsSitting = a_IsSitting; }
@@ -38,11 +39,12 @@ public:
private:
- bool m_bIsSitting;
- bool m_bIsTame;
- bool m_bIsBegging;
- bool m_bIsAngry;
+ bool m_bIsSitting;
+ bool m_bIsTame;
+ bool m_bIsBegging;
+ bool m_bIsAngry;
AString m_bOwner;
+ int m_bCollar;
} ;
diff --git a/source/Protocol/Protocol17x.cpp b/source/Protocol/Protocol17x.cpp
index ebf8f6c33..5022d6dbc 100644
--- a/source/Protocol/Protocol17x.cpp
+++ b/source/Protocol/Protocol17x.cpp
@@ -1752,6 +1752,8 @@ void cProtocol172::cPacketizer::WriteMobMetadata(const cMonster & a_Mob)
WriteFloat((float)(a_Mob.GetHealth()));
WriteByte(0x13);
WriteByte(Wolf.IsBegging() ? 1 : 0);
+ WriteByte(0x14);
+ WriteByte(Wolf.GetCollarColor());
break;
}