aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Particle.cpp
diff options
context:
space:
mode:
authorModMaker101 <119018978+ModMaker101@users.noreply.github.com>2026-03-07 21:56:03 -0500
committerGitHub <noreply@github.com>2026-03-08 09:56:03 +0700
commita9be52c41a02d207233199e98898fe7483d7e817 (patch)
tree71dfaec3a86b05e9ca409b97d8eb9d7f993bfdd0 /Minecraft.Client/Particle.cpp
parent1be5faaea781402e7de06b263eeca4c688b7712c (diff)
Project modernization (#630)
* 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
Diffstat (limited to 'Minecraft.Client/Particle.cpp')
-rw-r--r--Minecraft.Client/Particle.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/Minecraft.Client/Particle.cpp b/Minecraft.Client/Particle.cpp
index 1091a26a..643dc669 100644
--- a/Minecraft.Client/Particle.cpp
+++ b/Minecraft.Client/Particle.cpp
@@ -19,7 +19,7 @@ void Particle::_init(Level *level, double x, double y, double z)
{
// 4J - added these initialisers
alpha = 1.0f;
- tex = NULL;
+ tex = nullptr;
gravity = 0.0f;
setSize(0.2f, 0.2f);
@@ -35,7 +35,7 @@ void Particle::_init(Level *level, double x, double y, double z)
size = (random->nextFloat() * 0.5f + 0.5f) * 2;
- lifetime = (int) (4 / (random->nextFloat() * 0.9f + 0.1f));
+ lifetime = static_cast<int>(4 / (random->nextFloat() * 0.9f + 0.1f));
age = 0;
texX = 0;
@@ -51,10 +51,10 @@ Particle::Particle(Level *level, double x, double y, double z, double xa, double
{
_init(level,x,y,z);
- xd = xa + (float) (Math::random() * 2 - 1) * 0.4f;
- yd = ya + (float) (Math::random() * 2 - 1) * 0.4f;
- zd = za + (float) (Math::random() * 2 - 1) * 0.4f;
- float speed = (float) (Math::random() + Math::random() + 1) * 0.15f;
+ xd = xa + static_cast<float>(Math::random() * 2 - 1) * 0.4f;
+ yd = ya + static_cast<float>(Math::random() * 2 - 1) * 0.4f;
+ zd = za + static_cast<float>(Math::random() * 2 - 1) * 0.4f;
+ float speed = static_cast<float>(Math::random() + Math::random() + 1) * 0.15f;
float dd = (float) (Mth::sqrt(xd * xd + yd * yd + zd * zd));
xd = xd / dd * speed * 0.4f;
@@ -156,7 +156,7 @@ void Particle::render(Tesselator *t, float a, float xa, float ya, float za, floa
float v1 = v0 + 0.999f / 16.0f;
float r = 0.1f * size;
- if (tex != NULL)
+ if (tex != nullptr)
{
u0 = tex->getU0();
u1 = tex->getU1();
@@ -164,9 +164,9 @@ void Particle::render(Tesselator *t, float a, float xa, float ya, float za, floa
v1 = tex->getV1();
}
- float x = (float) (xo + (this->x - xo) * a - xOff);
- float y = (float) (yo + (this->y - yo) * a - yOff);
- float z = (float) (zo + (this->z - zo) * a - zOff);
+ float x = static_cast<float>(xo + (this->x - xo) * a - xOff);
+ float y = static_cast<float>(yo + (this->y - yo) * a - yOff);
+ float z = static_cast<float>(zo + (this->z - zo) * a - zOff);
float br = 1.0f; // 4J - change brought forward from 1.8.2
if( !SharedConstants::TEXTURE_LIGHTING )