From b3feddfef372618c8a9d7a0abcaf18cfad866c18 Mon Sep 17 00:00:00 2001 From: daoge <3523206925@qq.com> Date: Tue, 3 Mar 2026 03:04:10 +0800 Subject: 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 --- Minecraft.World/AgableMob.cpp | 50 +++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 14 deletions(-) (limited to 'Minecraft.World/AgableMob.cpp') diff --git a/Minecraft.World/AgableMob.cpp b/Minecraft.World/AgableMob.cpp index 39bcadbe..307aa767 100644 --- a/Minecraft.World/AgableMob.cpp +++ b/Minecraft.World/AgableMob.cpp @@ -13,40 +13,51 @@ AgableMob::AgableMob(Level *level) : PathfinderMob(level) registeredBBHeight = 0; } -bool AgableMob::interact(shared_ptr player) +bool AgableMob::mobInteract(shared_ptr player) { shared_ptr item = player->inventory->getSelected(); - if (item != NULL && item->id == Item::monsterPlacer_Id) + if (item != NULL && item->id == Item::spawnEgg_Id) { if (!level->isClientSide) { eINSTANCEOF classToSpawn = EntityIO::getClass(item->getAuxValue()); if (classToSpawn != eTYPE_NOTSET && (classToSpawn & eTYPE_AGABLE_MOB) == eTYPE_AGABLE_MOB && classToSpawn == GetType() ) // 4J Added GetType() check to only spawn same type { - shared_ptr offspring = getBreedOffspring(dynamic_pointer_cast(shared_from_this())); - if (offspring != NULL) - { - offspring->setAge(-20 * 60 * 20); - offspring->moveTo(x, y, z, 0, 0); - - level->addEntity(offspring); + int error; + shared_ptr result = SpawnEggItem::canSpawn(item->getAuxValue(), level, &error); - if (!player->abilities.instabuild) + if (result != NULL) + { + shared_ptr offspring = getBreedOffspring(dynamic_pointer_cast(shared_from_this())); + if (offspring != NULL) { - item->count--; + offspring->setAge(BABY_START_AGE); + offspring->moveTo(x, y, z, 0, 0); - if (item->count <= 0) + level->addEntity(offspring); + + if (!player->abilities.instabuild) { - player->inventory->setItem(player->inventory->selected, nullptr); + item->count--; + + if (item->count <= 0) + { + player->inventory->setItem(player->inventory->selected, nullptr); + } } } } + else + { + SpawnEggItem::DisplaySpawnError(player, error); + } } } + return true; } - return PathfinderMob::interact(player); + return false; } void AgableMob::defineSynchedData() @@ -60,6 +71,17 @@ int AgableMob::getAge() return entityData->getInteger(DATA_AGE_ID); } +void AgableMob::ageUp(int seconds) +{ + int age = getAge(); + age += seconds * SharedConstants::TICKS_PER_SECOND; + if (age > 0) + { + age = 0; + } + setAge(age); +} + void AgableMob::setAge(int age) { entityData->set(DATA_AGE_ID, age); -- cgit v1.2.3