Cuberite
A lightweight, fast and extensible game server for Minecraft
Sheep.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "PassiveMonster.h"
5 
6 
7 
8 
9 
10 class cSheep:
11  public cPassiveMonster
12 {
14 
15 public:
16 
21  cSheep(int a_Color = -1);
22 
24 
25  virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
26  virtual void OnRightClicked(cPlayer & a_Player) override;
27  virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
28  virtual void InheritFromParents(cMonster * a_Parent1, cMonster * a_Parent2) override;
29 
30  virtual void GetFollowedItems(cItems & a_Items) override
31  {
32  a_Items.Add(E_ITEM_WHEAT);
33  }
34 
38 
39  bool IsSheared(void) const { return m_IsSheared; }
40  void SetSheared(bool a_IsSheared) { m_IsSheared = a_IsSheared; }
41 
42  int GetFurColor(void) const { return m_WoolColor; }
43  void SetFurColor(int a_WoolColor) { m_WoolColor = a_WoolColor; }
44 
45 private:
49 
50 } ;
51 
52 
53 
54 
@ E_ITEM_WHEAT
Definition: BlockType.h:340
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:44
#define CLASS_PROTODEF(classname)
Definition: Entity.h:13
Definition: Chunk.h:36
Definition: Entity.h:76
Definition: Player.h:29
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:215
void Add(const cItem &a_Item)
Definition: Item.h:233
cPassiveMonster(const AString &a_ConfigName, eMonsterType a_MobType, const AString &a_SoundHurt, const AString &a_SoundDeath, const AString &a_SoundAmbient, float a_Width, float a_Height)
Definition: Sheep.h:12
virtual void GetFollowedItems(cItems &a_Items) override
Returns the items that the animal of this class follows when a player holds it in hand.
Definition: Sheep.h:30
void SetSheared(bool a_IsSheared)
Definition: Sheep.h:40
void SetFurColor(int a_WoolColor)
Definition: Sheep.h:43
bool IsSheared(void) const
Definition: Sheep.h:39
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
Definition: Sheep.cpp:92
int m_WoolColor
Definition: Sheep.h:47
virtual void OnRightClicked(cPlayer &a_Player) override
Called when the specified player right-clicks this entity.
Definition: Sheep.cpp:60
int m_TimeToStopEating
Definition: Sheep.h:48
cSheep(int a_Color=-1)
The number is the color of the sheep.
Definition: Sheep.cpp:14
static NIBBLETYPE GenerateNaturalRandomColor(void)
Generates a random color for the sheep like the vanilla server.
Definition: Sheep.cpp:180
bool m_IsSheared
Definition: Sheep.h:46
virtual void InheritFromParents(cMonster *a_Parent1, cMonster *a_Parent2) override
Called after the baby is born, allows the baby to inherit the parents' properties (color,...
Definition: Sheep.cpp:143
virtual void GetDrops(cItems &a_Drops, cEntity *a_Killer=nullptr) override
Returns the list of drops for this pawn when it is killed.
Definition: Sheep.cpp:36
int GetFurColor(void) const
Definition: Sheep.h:42