Files
MinecraftConsoles/Minecraft.Client/BubbleParticle.cpp
ModMaker101 a9be52c41a 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
2026-03-08 09:56:03 +07:00

41 lines
1.1 KiB
C++

#include "stdafx.h"
#include "BubbleParticle.h"
#include "..\Minecraft.World\Random.h"
#include "..\Minecraft.World\Mth.h"
#include "..\Minecraft.World\JavaMath.h"
#include "..\Minecraft.World\net.minecraft.world.level.h"
#include "..\Minecraft.World\net.minecraft.world.level.material.h"
BubbleParticle::BubbleParticle(Level *level, double x, double y, double z, double xa, double ya, double za) : Particle(level, x, y, z, xa, ya, za)
{
rCol = 1.0f;
gCol = 1.0f;
bCol = 1.0f;
setMiscTex(32);
this->setSize(0.02f, 0.02f);
size = size*(random->nextFloat()*0.6f+0.2f);
xd = xa*0.2f+static_cast<float>(Math::random() * 2 - 1)*0.02f;
yd = ya*0.2f+static_cast<float>(Math::random() * 2 - 1)*0.02f;
zd = za*0.2f+static_cast<float>(Math::random() * 2 - 1)*0.02f;
lifetime = static_cast<int>(8 / (Math::random() * 0.8 + 0.2));
}
void BubbleParticle::tick()
{
xo = x;
yo = y;
zo = z;
yd += 0.002;
move(xd, yd, zd);
xd *= 0.85f;
yd *= 0.85f;
zd *= 0.85f;
if (level->getMaterial(Mth::floor(x), Mth::floor(y), Mth::floor(z)) != Material::water) remove();
if (lifetime-- <= 0) remove();
}