diff options
| author | ModMaker101 <119018978+ModMaker101@users.noreply.github.com> | 2026-03-08 19:08:36 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-08 18:08:36 -0500 |
| commit | 28614b922fb77149a54da1a87bebfbc98736f296 (patch) | |
| tree | 7f828ba86a4ee18d0a80d29de64f6199a5412512 /Minecraft.World/Blaze.cpp | |
| parent | 88798b501d0cf6287b6f87acb2592676e3cec58d (diff) | |
Modernize project codebase (#906)
* Fixed boats falling and a TP glitch #266
* Replaced every C-style cast with C++ ones
* Replaced every C-style cast with C++ ones
* Fixed boats falling and a TP glitch #266
* Updated NULL to nullptr and fixing some type issues
* Modernized and fixed a few bugs
- Replaced most instances of `NULL` with `nullptr`.
- Replaced most `shared_ptr(new ...)` with `make_shared`.
- Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances.
* Fixing more conflicts
* Replace int loops with size_t and start work on overrides
* Add safety checks and fix a issue with vector going OOR
Diffstat (limited to 'Minecraft.World/Blaze.cpp')
| -rw-r--r-- | Minecraft.World/Blaze.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Minecraft.World/Blaze.cpp b/Minecraft.World/Blaze.cpp index d87a83b2..ec72dfcb 100644 --- a/Minecraft.World/Blaze.cpp +++ b/Minecraft.World/Blaze.cpp @@ -42,7 +42,7 @@ void Blaze::defineSynchedData() { Monster::defineSynchedData(); - entityData->define(DATA_FLAGS_ID, (byte) 0); + entityData->define(DATA_FLAGS_ID, static_cast<byte>(0)); } int Blaze::getAmbientSound() @@ -84,10 +84,10 @@ void Blaze::aiStep() if (nextHeightOffsetChangeTick <= 0) { nextHeightOffsetChangeTick = SharedConstants::TICKS_PER_SECOND * 5; - allowedHeightOffset = .5f + (float) random->nextGaussian() * 3; + allowedHeightOffset = .5f + static_cast<float>(random->nextGaussian()) * 3; } - if (getAttackTarget() != NULL && (getAttackTarget()->y + getAttackTarget()->getHeadHeight()) > (y + getHeadHeight() + allowedHeightOffset)) + if (getAttackTarget() != nullptr && (getAttackTarget()->y + getAttackTarget()->getHeadHeight()) > (y + getHeadHeight() + allowedHeightOffset)) { yd = yd + (.3f - yd) * .3f; } @@ -149,10 +149,10 @@ void Blaze::checkHurtTarget(shared_ptr<Entity> target, float d) { float sqd = sqrt(d) * .5f; - level->levelEvent(nullptr, LevelEvent::SOUND_BLAZE_FIREBALL, (int) x, (int) y, (int) z, 0); + level->levelEvent(nullptr, LevelEvent::SOUND_BLAZE_FIREBALL, static_cast<int>(x), static_cast<int>(y), static_cast<int>(z), 0); // level.playSound(this, "mob.ghast.fireball", getSoundVolume(), (random.nextFloat() - random.nextFloat()) * 0.2f + 1.0f); for (int i = 0; i < 1; i++) { - shared_ptr<SmallFireball> ie = shared_ptr<SmallFireball>( new SmallFireball(level, dynamic_pointer_cast<Mob>( shared_from_this() ), xd + random->nextGaussian() * sqd, yd, zd + random->nextGaussian() * sqd) ); + shared_ptr<SmallFireball> ie = std::make_shared<SmallFireball>(level, dynamic_pointer_cast<Mob>(shared_from_this()), xd + random->nextGaussian() * sqd, yd, zd + random->nextGaussian() * sqd); // Vec3 v = getViewVector(1); // ie.x = x + v.x * 1.5; ie->y = y + bbHeight / 2 + 0.5f; @@ -162,7 +162,7 @@ void Blaze::checkHurtTarget(shared_ptr<Entity> target, float d) } } - yRot = (float) (atan2(zd, xd) * 180 / PI) - 90; + yRot = static_cast<float>(atan2(zd, xd) * 180 / PI) - 90; holdGround = true; } |
