Skip to content

Commit 8c37225

Browse files
committed
Minor Creeper Optimizations
1 parent 5802901 commit 8c37225

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

source/world/entity/Creeper.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ void Creeper::tick()
2929

3030
m_swell += swellDir;
3131

32-
if (m_swell < 0) {
32+
if (m_swell < 0)
33+
{
3334
m_swell = 0;
3435
}
35-
36-
if (m_swell >= MAX_SWELL)
36+
else if (m_swell > MAX_SWELL)
3737
{
3838
m_swell = MAX_SWELL;
3939
}
@@ -82,7 +82,7 @@ void Creeper::checkHurtTarget(Entity* pEnt, float f)
8282
}
8383
}
8484

85-
float Creeper::getSwelling(float f)
85+
float Creeper::getSwelling(float f) const
8686
{
8787
return (m_oldSwell + (m_swell - m_oldSwell) * f) / 28.0f;
8888
}

source/world/entity/Creeper.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class Creeper : public Monster
1313
void tick() override;
1414
std::string getHurtSound() const override { return "mob.creeper"; }
1515
std::string getDeathSound() const override { return "mob.creeperdeath"; }
16-
float getSwelling(float f);
17-
int getSwellDir() { return m_entityData.get<int>(DATA_SWELL_DIR); }
16+
float getSwelling(float f) const;
17+
int getSwellDir() const { return m_entityData.get<int>(DATA_SWELL_DIR); }
1818
void setSwellDir(int value) { m_entityData.set<int>(DATA_SWELL_DIR, value); }
1919
int getDeathLoot() const override { return ITEM_SULPHUR; }
2020

0 commit comments

Comments
 (0)