Cuberite
A lightweight, fast and extensible game server for Minecraft
Rabbit.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "PassiveMonster.h"
5 
6 
7 
8 
9 
10 enum class eRabbitType : UInt8
11 {
12  Brown = 0,
13  White = 1,
14  Black = 2,
15  BlackAndWhite = 3,
16  Gold = 4,
17  SaltAndPepper = 5,
18  TheKillerBunny = 99
19 };
20 
21 
22 
23 
24 
25 class cRabbit:
26  public cPassiveMonster
27 {
29 
30 public:
31 
32  cRabbit();
33  cRabbit(eRabbitType Type, int MoreCarrotTicks = 0);
34 
36 
37  virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
38  virtual void GetFollowedItems(cItems & a_Items) override
39  {
40  a_Items.Add(E_ITEM_CARROT);
41  a_Items.Add(E_ITEM_GOLDEN_CARROT);
42  a_Items.Add(E_BLOCK_DANDELION);
43  }
44 
45  eRabbitType GetRabbitType() const { return m_Type; }
46  int GetMoreCarrotTicks() const { return m_MoreCarrotTicks; }
47 
48 private:
49 
51  int m_MoreCarrotTicks; // Ticks until the Rabbit eat planted Carrots
52 } ;
@ E_BLOCK_DANDELION
Definition: BlockType.h:47
@ E_ITEM_CARROT
Definition: BlockType.h:437
@ E_ITEM_GOLDEN_CARROT
Definition: BlockType.h:442
#define CLASS_PROTODEF(classname)
Definition: Entity.h:13
unsigned char UInt8
Definition: Globals.h:159
eRabbitType
Definition: Rabbit.h:11
Definition: Entity.h:76
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: Rabbit.h:27
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: Rabbit.h:38
eRabbitType GetRabbitType() const
Definition: Rabbit.h:45
virtual void GetDrops(cItems &a_Drops, cEntity *a_Killer=nullptr) override
Returns the list of drops for this pawn when it is killed.
Definition: Rabbit.cpp:34
cRabbit()
Definition: Rabbit.cpp:12
int m_MoreCarrotTicks
Definition: Rabbit.h:51
eRabbitType m_Type
Definition: Rabbit.h:50
int GetMoreCarrotTicks() const
Definition: Rabbit.h:46