diff options
| author | daoge <3523206925@qq.com> | 2026-03-03 03:04:10 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-03 03:04:10 +0800 |
| commit | b3feddfef372618c8a9d7a0abcaf18cfad866c18 (patch) | |
| tree | 267761c3bb39241ba5c347bfbe2254d06686e287 /Minecraft.World/MushroomCow.cpp | |
| parent | 84c31a2331f7a0ec85b9d438992e244f60e5020f (diff) | |
feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict
* feat: TU19 (Dec 2014) Features & Content (#32)
* December 2014 files
* Working release build
* Fix compilation issues
* Add sound to Windows64Media
* Add DLC content and force Tutorial DLC
* Revert "Add DLC content and force Tutorial DLC"
This reverts commit 97a43994725008e35fceb984d5549df9c8cea470.
* Disable broken light packing
* Disable breakpoint during DLC texture map load
Allows DLC loading but the DLC textures are still broken
* Fix post build not working
* ...
* fix vs2022 build
* fix cmake build
---------
Co-authored-by: Loki <lokirautio@gmail.com>
Diffstat (limited to 'Minecraft.World/MushroomCow.cpp')
| -rw-r--r-- | Minecraft.World/MushroomCow.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/Minecraft.World/MushroomCow.cpp b/Minecraft.World/MushroomCow.cpp index a2aef158..0f88c843 100644 --- a/Minecraft.World/MushroomCow.cpp +++ b/Minecraft.World/MushroomCow.cpp @@ -13,14 +13,15 @@ MushroomCow::MushroomCow(Level *level) : Cow(level) { - // 4J Stu - This function call had to be moved here from the Entity ctor to ensure that the derived version of the function is called - health = getMaxHealth(); + // 4J Stu - This function call had to be moved here from the Entity ctor to ensure that + // the derived version of the function is called + this->defineSynchedData(); + setHealth(getMaxHealth()); - this->textureIdx = TN_MOB_RED_COW;// 4J was "/mob/redcow.png"; this->setSize(0.9f, 1.3f); } -bool MushroomCow::interact(shared_ptr<Player> player) +bool MushroomCow::mobInteract(shared_ptr<Player> player) { shared_ptr<ItemInstance> item = player->inventory->getSelected(); if (item != NULL && item->id == Item::bowl_Id && getAge() >= 0) @@ -36,14 +37,14 @@ bool MushroomCow::interact(shared_ptr<Player> player) player->inventory->removeItem(player->inventory->selected, 1); return true; } - } - if (item != NULL && item->id == Item::shears_Id && getAge() >= 0) + } + // 4J: Do not allow shearing if we can't create more cows + if (item != NULL && item->id == Item::shears_Id && getAge() >= 0 && level->canCreateMore(eTYPE_COW, Level::eSpawnType_Breed)) { remove(); level->addParticle(eParticleType_largeexplode, x, y + bbHeight / 2, z, 0, 0, 0); if(!level->isClientSide) { - // 4J Stu - We don't need to check spawn limits when adding the new cow, as we are removing the MushroomCow remove(); shared_ptr<Cow> cow = shared_ptr<Cow>( new Cow(level) ); cow->moveTo(x, y, z, yRot, xRot); @@ -52,13 +53,13 @@ bool MushroomCow::interact(shared_ptr<Player> player) level->addEntity(cow); for (int i = 0; i < 5; i++) { - level->addEntity( shared_ptr<ItemEntity>( new ItemEntity(level, x, y + bbHeight, z, shared_ptr<ItemInstance>( new ItemInstance(Tile::mushroom2))) )); + level->addEntity( shared_ptr<ItemEntity>( new ItemEntity(level, x, y + bbHeight, z, shared_ptr<ItemInstance>( new ItemInstance(Tile::mushroom_red))) )); } - return true; + return true; } return true; } - return Cow::interact(player); + return Cow::mobInteract(player); } // 4J - added so that mushroom cows have more of a chance of spawning, they can now spawn on mycelium as well as grass - seems a bit odd that they don't already really |
