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 <lokirautio@gmail.com>
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -435,4 +435,5 @@ build/*
|
|||||||
Minecraft.Client/Saves/
|
Minecraft.Client/Saves/
|
||||||
|
|
||||||
# Visual Studio Per-User Config
|
# Visual Studio Per-User Config
|
||||||
*.user
|
*.user
|
||||||
|
/out
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ bool Zombie::isBaby()
|
|||||||
void Zombie::setBaby(bool baby)
|
void Zombie::setBaby(bool baby)
|
||||||
{
|
{
|
||||||
getEntityData()->set(DATA_BABY_ID, (byte) (baby ? 1 : 0));
|
getEntityData()->set(DATA_BABY_ID, (byte) (baby ? 1 : 0));
|
||||||
|
updateSize(baby);
|
||||||
|
|
||||||
if (level != NULL && !level->isClientSide)
|
if (level != NULL && !level->isClientSide)
|
||||||
{
|
{
|
||||||
@@ -209,6 +210,11 @@ void Zombie::tick()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Monster::tick();
|
Monster::tick();
|
||||||
|
|
||||||
|
if (level->isClientSide)
|
||||||
|
{
|
||||||
|
updateSize(isBaby());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Zombie::doHurtTarget(shared_ptr<Entity> target)
|
bool Zombie::doHurtTarget(shared_ptr<Entity> target)
|
||||||
@@ -226,6 +232,12 @@ bool Zombie::doHurtTarget(shared_ptr<Entity> target)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Zombie::updateSize(bool isBaby)
|
||||||
|
{
|
||||||
|
float scale = isBaby ? 0.5f : 1.0f;
|
||||||
|
setSize(0.6f, 1.8f * scale);
|
||||||
|
}
|
||||||
|
|
||||||
int Zombie::getAmbientSound()
|
int Zombie::getAmbientSound()
|
||||||
{
|
{
|
||||||
return eSoundType_MOB_ZOMBIE_AMBIENT;
|
return eSoundType_MOB_ZOMBIE_AMBIENT;
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ public:
|
|||||||
virtual bool hurt(DamageSource *source, float dmg);
|
virtual bool hurt(DamageSource *source, float dmg);
|
||||||
virtual void tick();
|
virtual void tick();
|
||||||
virtual bool doHurtTarget(shared_ptr<Entity> target);
|
virtual bool doHurtTarget(shared_ptr<Entity> target);
|
||||||
|
virtual void updateSize(bool isBaby);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int getAmbientSound();
|
virtual int getAmbientSound();
|
||||||
|
|||||||
Reference in New Issue
Block a user