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  cPig(void);
17 
19 
20  // cEntity overrides
21  virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
22 
23  virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
24  virtual void OnRightClicked(cPlayer & a_Player) override;
25  virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
26 
27  virtual void GetFollowedItems(cItems & a_Items) override
28  {
29  a_Items.Add(E_ITEM_CARROT);
30  }
31 
32  bool IsSaddled(void) const { return m_bIsSaddled; }
33 
34 private:
35 
37 
38 } ;
39 
40 
41 
42 
Definition: FastNBT.h:131
bool m_bIsSaddled
Definition: Pig.h:36
Definition: Player.h:27
cPig(void)
Definition: Pig.cpp:12
virtual void OnRightClicked(cPlayer &a_Player) override
Called when the specified player right-clicks this entity.
Definition: Pig.cpp:45
Definition: Chunk.h:49
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
Definition: Pig.cpp:90
Definition: Pig.h:10
cPassiveMonster super
Definition: Pig.h:13
virtual bool DoTakeDamage(TakeDamageInfo &a_TDI) override
When hit by someone, run away.
Definition: Pig.cpp:113
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:27
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
Definition: Entity.h:73
#define CLASS_PROTODEF(classname)
Definition: Entity.h:11
bool IsSaddled(void) const
Definition: Pig.h:32
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:234