5 #include "../Entities/Player.h" 7 #include "../EffectID.h" 8 #include "../FastRandom.h" 15 super(
"Sheep",
mtSheep,
"entity.sheep.hurt",
"entity.sheep.death", 0.6, 1.3),
18 m_TimeToStopEating(-1)
48 unsigned int LootingLevel = 0;
49 if (a_Killer !=
nullptr)
147 short Parent1, Parent2, Child;
148 } ColorInheritance[] =
162 for (
size_t i = 0; i <
ARRAYCOUNT(ColorInheritance); i++)
165 ((Parent1->
GetFurColor() == ColorInheritance[i].Parent1) && (Parent2->
GetFurColor() == ColorInheritance[i].Parent2)) ||
166 ((Parent1->
GetFurColor() == ColorInheritance[i].Parent2) && (Parent2->
GetFurColor() == ColorInheritance[i].Parent1))
190 else if (Chance <= 86)
194 else if (Chance <= 91)
198 else if (Chance <= 96)
202 else if (Chance <= 99)
double GetPosY(void) const
double GetPosX(void) const
bool IsSheared(void) const
BLOCKTYPE GetBlock(Vector3i a_BlockPos)
Returns the block type at the specified position.
bool RemoveOneEquippedItem(void)
Removes one item out of the currently equipped item stack, returns true if successful, false if empty-handed.
MTRand & GetRandomProvider()
Returns the current thread's random number source.
virtual void BroadcastEntityMetadata(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
const cItem & GetEquippedItem(void) const
virtual bool IsOnFire(void) const
void AddRandomDropItem(cItems &a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth=0)
Adds a random number of a_Item between a_Min and a_Max to itemdrops a_Drops.
unsigned int GetLevel(int a_EnchantmentID) const
Returns the level for the specified enchantment; 0 if not stored.
virtual void InheritFromParents(cPassiveMonster *a_Parent1, cPassiveMonster *a_Parent2) override
Called after the baby is born, allows the baby to inherit the parents' properties (color...
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
static NIBBLETYPE GenerateNaturalRandomColor(void)
Generates a random color for the sheep like the vanilla server.
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
cSheep(int a_Color=-1)
The number is the color of the sheep.
void SpawnItemPickups(const cItems &a_Pickups, Vector3i a_BlockPos, double a_FlyAwaySpeed=1.0, bool a_IsPlayerCreated=false)
Spawns item pickups for each item in the list.
virtual void BroadcastSoundEffect(const AString &a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle *a_Exclude=nullptr) override
int GetFurColor(void) const
cEnchantments m_Enchantments
IntType RandInt(IntType a_Min, IntType a_Max)
Return a random IntType in the range [a_Min, a_Max].
virtual void BroadcastSoundParticleEffect(const EffectID a_EffectID, Vector3i a_SrcPos, int a_Data, const cClientHandle *a_Exclude=nullptr) override
bool IsTicking(void) const
Returns true if the entity is valid and ticking.
void SetFurColor(int a_WoolColor)
virtual void GetDrops(cItems &a_Drops, cEntity *a_Killer=nullptr) override
Returns the list of drops for this pawn when it is killed.
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
void UseEquippedItem(short a_Damage=1)
Damage the player's equipped item by a_Damage, possibly less if the equipped item is enchanted...
virtual cItem GetEquippedWeapon(void) const
Returns the curently equipped weapon; empty item if none.
const Vector3d & GetPosition(void) const
Exported in ManualBindings.
double GetPosZ(void) const
bool IsGameModeCreative(void) const
Returns true if the player is in Creative mode, either explicitly, or by inheriting from current worl...
virtual void OnRightClicked(cPlayer &a_Player) override
Called when the specified player right-clicks this entity.
void StopMovingToPosition()
Stops pathfinding.
cInventory & GetInventory(void)
void SetBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Sets the block at the specified coords to the specified value.
#define ARRAYCOUNT(X)
Evaluates to the number of elements in an array (compile-time!)
virtual void BroadcastEntityStatus(const cEntity &a_Entity, Int8 a_Status, const cClientHandle *a_Exclude=nullptr) override
cWorld * GetWorld(void) const
This class bridges a vector of cItem for safe access via Lua.
virtual void OnRightClicked(cPlayer &a_Player) override
Called when the specified player right-clicks this entity.