5 #include "../Entities/Player.h"
7 #include "../EffectID.h"
8 #include "../FastRandom.h"
15 Super(
"Sheep",
mtSheep,
"entity.sheep.hurt",
"entity.sheep.death",
"entity.sheep.ambient", 0.9f, 1.3f),
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))
188 else if (Chance <= 86)
192 else if (Chance <= 91)
196 else if (Chance <= 96)
200 else if (Chance <= 99)
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
MTRand & GetRandomProvider()
Returns the current thread's random number source.
#define ARRAYCOUNT(X)
Evaluates to the number of elements in an array (compile-time!)
unsigned int GetLevel(int a_EnchantmentID) const
Returns the level for the specified enchantment; 0 if not stored.
bool IsTicking(void) const
Returns true if the entity is valid and ticking.
double GetPosX(void) const
double GetPosZ(void) const
virtual bool IsOnFire(void) const
double GetPosY(void) const
virtual cItem GetEquippedWeapon(void) const
Returns the curently equipped weapon; empty item if none.
const Vector3d & GetPosition(void) const
Exported in ManualBindings.
cWorld * GetWorld(void) const
const cItem & GetEquippedItem(void) const
bool IsGameModeCreative(void) const
Returns true if the player is in Creative mode, either explicitly, or by inheriting from current worl...
cInventory & GetInventory(void)
void UseEquippedItem(short a_Damage=1)
Damage the player's equipped item by a_Damage, possibly less if the equipped item is enchanted.
IntType RandInt(IntType a_Min, IntType a_Max)
Return a random IntType in the range [a_Min, a_Max].
bool RemoveOneEquippedItem(void)
Removes one item out of the currently equipped item stack, returns true if successful,...
cEnchantments m_Enchantments
This class bridges a vector of cItem for safe access via Lua.
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.
void StopMovingToPosition()
Stops pathfinding.
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
virtual void OnRightClicked(cPlayer &a_Player) override
Called when the specified player right-clicks this entity.
void SetFurColor(int a_WoolColor)
bool IsSheared(void) const
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
virtual void OnRightClicked(cPlayer &a_Player) override
Called when the specified player right-clicks this entity.
cSheep(int a_Color=-1)
The number is the color of the sheep.
static NIBBLETYPE GenerateNaturalRandomColor(void)
Generates a random color for the sheep like the vanilla server.
virtual void InheritFromParents(cMonster *a_Parent1, cMonster *a_Parent2) override
Called after the baby is born, allows the baby to inherit the parents' properties (color,...
virtual void GetDrops(cItems &a_Drops, cEntity *a_Killer=nullptr) override
Returns the list of drops for this pawn when it is killed.
int GetFurColor(void) const
virtual void BroadcastEntityMetadata(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastEntityAnimation(const cEntity &a_Entity, EntityAnimation a_Animation, const cClientHandle *a_Exclude=nullptr) override
BLOCKTYPE GetBlock(Vector3i a_BlockPos) const
Returns the block type at the specified position.
virtual void BroadcastSoundParticleEffect(const EffectID a_EffectID, Vector3i a_SrcPos, int a_Data, const cClientHandle *a_Exclude=nullptr) override
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
void SetBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Sets the block at the specified coords to the specified value.