Cuberite
A lightweight, fast and extensible game server for Minecraft
Ocelot.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "PassiveMonster.h"
5 #include "../UUID.h"
6 
7 
8 
9 
10 
11 class cOcelot:
12  public cPassiveMonster
13 {
15 
16 public:
17 
18  enum eCatType
19  {
24  } ;
25 
26  cOcelot(void);
27 
29 
30  virtual void OnRightClicked(cPlayer & a_Player) override;
31  virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
32  virtual void TickFollowPlayer();
33  virtual void GetBreedingItems(cItems & a_Items) override
34  {
35  a_Items.Add(E_ITEM_RAW_FISH);
36  }
37  virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
38 
39  // Get functions
40  bool IsSitting (void) const override { return m_IsSitting; }
41  bool IsTame (void) const override { return m_IsTame; }
42  bool IsBegging (void) const { return m_IsBegging; }
43  AString GetOwnerName (void) const { return m_OwnerName; }
44  cUUID GetOwnerUUID (void) const { return m_OwnerUUID; }
45  eCatType GetOcelotType (void) const { return m_CatType; }
46 
47  // Set functions
48  void SetIsSitting (bool a_IsSitting) { m_IsSitting = a_IsSitting; }
49  void SetIsTame (bool a_IsTame) { m_IsTame = a_IsTame; }
50  void SetIsBegging (bool a_IsBegging) { m_IsBegging = a_IsBegging; }
51  void SetOwner (const AString & a_NewOwnerName, const cUUID & a_NewOwnerUUID)
52  {
53  m_OwnerName = a_NewOwnerName;
54  m_OwnerUUID = a_NewOwnerUUID;
55  }
56  void SetCatType (eCatType a_CatType) { m_CatType = a_CatType; }
57 
59  static bool IsCatSittingOnBlock(cWorld * a_World, Vector3d a_BlockPosition);
60 
61 protected:
62 
64  bool m_IsTame;
71 } ;
72 
73 
74 
75 
@ E_ITEM_RAW_FISH
Definition: BlockType.h:394
#define CLASS_PROTODEF(classname)
Definition: Entity.h:13
std::string AString
Definition: StringUtils.h:11
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
Definition: Ocelot.h:13
bool IsBegging(void) const
Definition: Ocelot.h:42
static bool IsCatSittingOnBlock(cWorld *a_World, Vector3d a_BlockPosition)
Returns true if there's a cat sitting above the given position.
Definition: Ocelot.cpp:196
bool m_IsSitting
Definition: Ocelot.h:63
virtual void TickFollowPlayer()
Definition: Ocelot.cpp:100
cUUID GetOwnerUUID(void) const
Definition: Ocelot.h:44
eCatType m_CatType
Definition: Ocelot.h:66
void SetIsTame(bool a_IsTame)
Definition: Ocelot.h:49
void SetOwner(const AString &a_NewOwnerName, const cUUID &a_NewOwnerUUID)
Definition: Ocelot.h:51
void SetIsBegging(bool a_IsBegging)
Definition: Ocelot.h:50
eCatType GetOcelotType(void) const
Definition: Ocelot.h:45
cOcelot(void)
Definition: Ocelot.cpp:23
bool IsSitting(void) const override
Definition: Ocelot.h:40
virtual void GetBreedingItems(cItems &a_Items) override
Returns the items that make the animal breed - this is usually the same as the ones that make the ani...
Definition: Ocelot.h:33
void SetCatType(eCatType a_CatType)
Definition: Ocelot.h:56
cUUID m_OwnerUUID
Definition: Ocelot.h:70
bool m_IsTame
Definition: Ocelot.h:64
virtual void OnRightClicked(cPlayer &a_Player) override
Called when the specified player right-clicks this entity.
Definition: Ocelot.cpp:141
int m_CheckPlayerTickCount
Only check for a nearby player holding the breeding items every 23 ticks.
Definition: Ocelot.h:68
AString GetOwnerName(void) const
Definition: Ocelot.h:43
virtual bool DoTakeDamage(TakeDamageInfo &a_TDI) override
When hit by someone, run away.
Definition: Ocelot.cpp:215
bool IsTame(void) const override
Definition: Ocelot.h:41
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
Definition: Ocelot.cpp:38
void SetIsSitting(bool a_IsSitting)
Definition: Ocelot.h:48
AString m_OwnerName
Definition: Ocelot.h:69
bool m_IsBegging
Definition: Ocelot.h:65
eCatType
Definition: Ocelot.h:19
@ ctSiamese
Definition: Ocelot.h:23
@ ctWildOcelot
Definition: Ocelot.h:20
@ ctTabby
Definition: Ocelot.h:22
@ ctTuxedo
Definition: Ocelot.h:21
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: UUID.h:11
Definition: World.h:53