From e585595ae64cc5523547c95cb8bebeb8e60f141b Mon Sep 17 00:00:00 2001 From: Bond-009 Date: Sat, 21 Oct 2017 18:55:46 +0200 Subject: Fixed some small passive mob issues (#4057) * Chickens can be bred with seeds, beetroot seeds, melon seeds, or pumpkin seeds Ref: https://minecraft.gamepedia.com/Chicken#Baby_chicken * Baby passive mobs don't drop items * Fixed the size of some mobs --- src/Mobs/Chicken.cpp | 19 ++++++++++--------- src/Mobs/Chicken.h | 3 +++ src/Mobs/Cow.cpp | 5 +++++ src/Mobs/Horse.cpp | 5 +++++ src/Mobs/Mooshroom.cpp | 5 +++++ src/Mobs/Pig.cpp | 5 +++++ src/Mobs/Rabbit.cpp | 5 +++++ src/Mobs/Sheep.cpp | 5 +++++ src/Mobs/Silverfish.h | 2 +- 9 files changed, 44 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/Mobs/Chicken.cpp b/src/Mobs/Chicken.cpp index 1068295e6..e2caa6f67 100644 --- a/src/Mobs/Chicken.cpp +++ b/src/Mobs/Chicken.cpp @@ -10,7 +10,7 @@ cChicken::cChicken(void) : - super("Chicken", mtChicken, "entity.chicken.hurt", "entity.chicken.death", 0.3, 0.4), + super("Chicken", mtChicken, "entity.chicken.hurt", "entity.chicken.death", 0.4, 0.7), m_EggDropTimer(0) { SetGravity(-2.0f); @@ -34,14 +34,10 @@ void cChicken::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) return; // Babies don't lay eggs } - if ((m_EggDropTimer == 6000) && GetRandomProvider().RandBool()) - { - cItems Drops; - m_EggDropTimer = 0; - Drops.push_back(cItem(E_ITEM_EGG, 1)); - m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10); - } - else if (m_EggDropTimer == 12000) + if ( + ((m_EggDropTimer == 6000) && GetRandomProvider().RandBool()) || + m_EggDropTimer == 12000 + ) { cItems Drops; m_EggDropTimer = 0; @@ -60,6 +56,11 @@ void cChicken::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) void cChicken::GetDrops(cItems & a_Drops, cEntity * a_Killer) { + if (IsBaby()) + { + return; // Babies don't drop items + } + unsigned int LootingLevel = 0; if (a_Killer != nullptr) { diff --git a/src/Mobs/Chicken.h b/src/Mobs/Chicken.h index 3be338b15..0dfc5e3d6 100644 --- a/src/Mobs/Chicken.h +++ b/src/Mobs/Chicken.h @@ -21,6 +21,9 @@ public: virtual void GetFollowedItems(cItems & a_Items) override { + a_Items.Add(E_ITEM_BEETROOT_SEEDS); + a_Items.Add(E_ITEM_MELON_SEEDS); + a_Items.Add(E_ITEM_PUMPKIN_SEEDS); a_Items.Add(E_ITEM_SEEDS); } diff --git a/src/Mobs/Cow.cpp b/src/Mobs/Cow.cpp index 9736fe440..003159959 100644 --- a/src/Mobs/Cow.cpp +++ b/src/Mobs/Cow.cpp @@ -21,6 +21,11 @@ cCow::cCow(void) : void cCow::GetDrops(cItems & a_Drops, cEntity * a_Killer) { + if (IsBaby()) + { + return; // Babies don't drop items + } + unsigned int LootingLevel = 0; if (a_Killer != nullptr) { diff --git a/src/Mobs/Horse.cpp b/src/Mobs/Horse.cpp index c55acf572..07d3f7481 100644 --- a/src/Mobs/Horse.cpp +++ b/src/Mobs/Horse.cpp @@ -169,6 +169,11 @@ void cHorse::OnRightClicked(cPlayer & a_Player) void cHorse::GetDrops(cItems & a_Drops, cEntity * a_Killer) { + if (IsBaby()) + { + return; // Babies don't drop items + } + unsigned int LootingLevel = 0; if (a_Killer != nullptr) { diff --git a/src/Mobs/Mooshroom.cpp b/src/Mobs/Mooshroom.cpp index b6feca76e..fc901e627 100644 --- a/src/Mobs/Mooshroom.cpp +++ b/src/Mobs/Mooshroom.cpp @@ -24,6 +24,11 @@ cMooshroom::cMooshroom(void) : void cMooshroom::GetDrops(cItems & a_Drops, cEntity * a_Killer) { + if (IsBaby()) + { + return; // Babies don't drop items + } + unsigned int LootingLevel = 0; if (a_Killer != nullptr) { diff --git a/src/Mobs/Pig.cpp b/src/Mobs/Pig.cpp index 82901b061..c9b276f62 100644 --- a/src/Mobs/Pig.cpp +++ b/src/Mobs/Pig.cpp @@ -21,6 +21,11 @@ cPig::cPig(void) : void cPig::GetDrops(cItems & a_Drops, cEntity * a_Killer) { + if (IsBaby()) + { + return; // Babies don't drop items + } + unsigned int LootingLevel = 0; if (a_Killer != nullptr) { diff --git a/src/Mobs/Rabbit.cpp b/src/Mobs/Rabbit.cpp index f4de0ba0c..d6a26f822 100644 --- a/src/Mobs/Rabbit.cpp +++ b/src/Mobs/Rabbit.cpp @@ -33,6 +33,11 @@ cRabbit::cRabbit(eRabbitType Type, int MoreCarrotTicks) : void cRabbit::GetDrops(cItems & a_Drops, cEntity * a_Killer) { + if (IsBaby()) + { + return; // Babies don't drop items + } + unsigned int LootingLevel = 0; if (a_Killer != nullptr) { diff --git a/src/Mobs/Sheep.cpp b/src/Mobs/Sheep.cpp index 814c87f5d..190fac241 100644 --- a/src/Mobs/Sheep.cpp +++ b/src/Mobs/Sheep.cpp @@ -35,6 +35,11 @@ cSheep::cSheep(int a_Color) : void cSheep::GetDrops(cItems & a_Drops, cEntity * a_Killer) { + if (IsBaby()) + { + return; // Babies don't drop items + } + if (!m_IsSheared) { a_Drops.push_back(cItem(E_BLOCK_WOOL, 1, static_cast(m_WoolColor))); diff --git a/src/Mobs/Silverfish.h b/src/Mobs/Silverfish.h index 90ef5ea5d..c234573ba 100644 --- a/src/Mobs/Silverfish.h +++ b/src/Mobs/Silverfish.h @@ -14,7 +14,7 @@ class cSilverfish : public: cSilverfish(void) : - super("Silverfish", mtSilverfish, "entity.silverfish.hurt", "entity.silverfish.death", 0.3, 0.7) + super("Silverfish", mtSilverfish, "entity.silverfish.hurt", "entity.silverfish.death", 0.3, 0.4) { } -- cgit v1.2.3