From 28614b922fb77149a54da1a87bebfbc98736f296 Mon Sep 17 00:00:00 2001 From: ModMaker101 <119018978+ModMaker101@users.noreply.github.com> Date: Sun, 8 Mar 2026 19:08:36 -0400 Subject: 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 --- Minecraft.World/EyeOfEnderSignal.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'Minecraft.World/EyeOfEnderSignal.cpp') diff --git a/Minecraft.World/EyeOfEnderSignal.cpp b/Minecraft.World/EyeOfEnderSignal.cpp index 95747a89..ca76b272 100644 --- a/Minecraft.World/EyeOfEnderSignal.cpp +++ b/Minecraft.World/EyeOfEnderSignal.cpp @@ -80,9 +80,9 @@ void EyeOfEnderSignal::lerpMotion(double xd, double yd, double zd) this->zd = zd; if (xRotO == 0 && yRotO == 0) { - float sd = (float) sqrt(xd * xd + zd * zd); - yRotO = yRot = (float) (atan2(xd, zd) * 180 / PI); - xRotO = xRot = (float) (atan2(yd, (double)sd) * 180 / PI); + float sd = static_cast(sqrt(xd * xd + zd * zd)); + yRotO = yRot = static_cast(atan2(xd, zd) * 180 / PI); + xRotO = xRot = static_cast(atan2(yd, (double)sd) * 180 / PI); } } @@ -97,9 +97,9 @@ void EyeOfEnderSignal::tick() y += yd; z += zd; - float sd = (float) sqrt(xd * xd + zd * zd); - yRot = (float) (atan2(xd, zd) * 180 / PI); - xRot = (float) (atan2(yd, (double)sd) * 180 / PI); + float sd = static_cast(sqrt(xd * xd + zd * zd)); + yRot = static_cast(atan2(xd, zd) * 180 / PI); + xRot = static_cast(atan2(yd, (double)sd) * 180 / PI); while (xRot - xRotO < -180) xRotO -= 360; @@ -117,8 +117,8 @@ void EyeOfEnderSignal::tick() if (!level->isClientSide) { double dx = tx - x, dz = tz - z; - float tdist = (float) sqrt(dx * dx + dz * dz); - float angle = (float) atan2(dz, dx); + float tdist = static_cast(sqrt(dx * dx + dz * dz)); + float angle = static_cast(atan2(dz, dx)); double tspeed = (sd + (tdist - sd) * .0025); if (tdist < 1) { @@ -163,11 +163,11 @@ void EyeOfEnderSignal::tick() remove(); if (surviveAfterDeath) { - level->addEntity(shared_ptr( new ItemEntity(level, x, y, z, shared_ptr(new ItemInstance(Item::eyeOfEnder))))); + level->addEntity(std::make_shared(level, x, y, z, shared_ptr(new ItemInstance(Item::eyeOfEnder)))); } else { - level->levelEvent(LevelEvent::PARTICLES_EYE_OF_ENDER_DEATH, (int) Math::round(x), (int) Math::round(y), (int) Math::round(z), 0); + level->levelEvent(LevelEvent::PARTICLES_EYE_OF_ENDER_DEATH, static_cast(Math::round(x)), static_cast(Math::round(y)), static_cast(Math::round(z)), 0); } } } -- cgit v1.2.3