From a6699a2e6f98c486a63c59c164ea2ee797c44d29 Mon Sep 17 00:00:00 2001 From: FriedMonkey <120042050+Friedmonkey@users.noreply.github.com> Date: Sat, 7 Mar 2026 01:45:22 +0100 Subject: [PATCH] Fixed baby zombie hitbox size (#765) * Added scaling to zombie i added scaling to zombie based on if its a baby or not just setting the size does not work you have to set it in the tick (look at the tick for slimes which is a scalable monster) * add output dir to gitignore the build output folder is now added to the git ignore --------- Co-authored-by: Loki --- .gitignore | 3 ++- Minecraft.World/Zombie.cpp | 12 ++++++++++++ Minecraft.World/Zombie.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 521f1d03..9abf7507 100644 --- a/.gitignore +++ b/.gitignore @@ -435,4 +435,5 @@ build/* Minecraft.Client/Saves/ # Visual Studio Per-User Config -*.user \ No newline at end of file +*.user +/out diff --git a/Minecraft.World/Zombie.cpp b/Minecraft.World/Zombie.cpp index 7cdc3180..e923822c 100644 --- a/Minecraft.World/Zombie.cpp +++ b/Minecraft.World/Zombie.cpp @@ -93,6 +93,7 @@ bool Zombie::isBaby() void Zombie::setBaby(bool baby) { getEntityData()->set(DATA_BABY_ID, (byte) (baby ? 1 : 0)); + updateSize(baby); if (level != NULL && !level->isClientSide) { @@ -209,6 +210,11 @@ void Zombie::tick() } Monster::tick(); + + if (level->isClientSide) + { + updateSize(isBaby()); + } } bool Zombie::doHurtTarget(shared_ptr target) @@ -226,6 +232,12 @@ bool Zombie::doHurtTarget(shared_ptr target) return result; } +void Zombie::updateSize(bool isBaby) +{ + float scale = isBaby ? 0.5f : 1.0f; + setSize(0.6f, 1.8f * scale); +} + int Zombie::getAmbientSound() { return eSoundType_MOB_ZOMBIE_AMBIENT; diff --git a/Minecraft.World/Zombie.h b/Minecraft.World/Zombie.h index d79df182..f788ea63 100644 --- a/Minecraft.World/Zombie.h +++ b/Minecraft.World/Zombie.h @@ -60,6 +60,7 @@ public: virtual bool hurt(DamageSource *source, float dmg); virtual void tick(); virtual bool doHurtTarget(shared_ptr target); + virtual void updateSize(bool isBaby); protected: virtual int getAmbientSound();