1
0

Initial Metadata Commit [SEE DESC]

+ Pigs, Minecarts, Sheep, Skeletons, Slimes, Villagers, Wolves, and
Horses have metadata
+ Base code on taming wolves, shearing sheep, and taming horses
+ Sheep and horses have different colours when spawned
This commit is contained in:
Tiger Wang
2013-10-08 19:20:49 +01:00
parent 21b23ff1e7
commit 5db6213f34
23 changed files with 714 additions and 95 deletions

View File

@@ -3,15 +3,17 @@
#include "Sheep.h"
#include "../BlockID.h"
#include "../Entities/Player.h"
#include "../World.h"
cSheep::cSheep(void) :
cSheep::cSheep(int a_Color) :
super("Sheep", 91, "mob.sheep.say", "mob.sheep.say", 0.6, 1.3),
m_IsSheared(false),
m_WoolColor(E_META_WOOL_WHITE)
m_WoolColor(a_Color)
{
}
@@ -30,3 +32,25 @@ void cSheep::GetDrops(cItems & a_Drops, cEntity * a_Killer)
void cSheep::OnRightClicked(cPlayer & a_Player)
{
if ((a_Player.GetEquippedItem().m_ItemType == E_ITEM_SHEARS) && (!m_IsSheared))
{
m_IsSheared = true;
m_World->BroadcastEntityMetadata(*this);
if (!a_Player.IsGameModeCreative())
{
a_Player.UseEquippedItem();
}
cItems Drops;
Drops.push_back(cItem(E_BLOCK_WOOL, 4, m_WoolColor));
m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10);
}
}