Cuberite
A lightweight, fast and extensible game server for Minecraft
Pig.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "PassiveMonster.h"
5 
6 
7 
8 
9 
10 class cPig:
11  public cPassiveMonster
12 {
14 
15 public:
16 
17  cPig();
18 
20 
21  // cEntity overrides
22  virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
23 
24  virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
25  virtual void OnRightClicked(cPlayer & a_Player) override;
26  virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
27 
28  virtual void GetFollowedItems(cItems & a_Items) override
29  {
30  a_Items.Add(E_ITEM_CARROT);
31  }
32 
33  bool IsSaddled(void) const { return m_bIsSaddled; }
34 
35 private:
36 
38 
39 } ;
40 
41 
42 
43 
@ E_ITEM_CARROT
Definition: BlockType.h:437
#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: Pig.h:12
virtual bool DoTakeDamage(TakeDamageInfo &a_TDI) override
When hit by someone, run away.
Definition: Pig.cpp:113
bool m_bIsSaddled
Definition: Pig.h:37
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: Pig.h:28
cPig()
Definition: Pig.cpp:12
virtual void GetDrops(cItems &a_Drops, cEntity *a_Killer=nullptr) override
Returns the list of drops for this pawn when it is killed.
Definition: Pig.cpp:22
bool IsSaddled(void) const
Definition: Pig.h:33
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
Definition: Pig.cpp:90
virtual void OnRightClicked(cPlayer &a_Player) override
Called when the specified player right-clicks this entity.
Definition: Pig.cpp:45