diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/BubbleParticle.cpp | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.Client/BubbleParticle.cpp')
| -rw-r--r-- | Minecraft.Client/BubbleParticle.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Minecraft.Client/BubbleParticle.cpp b/Minecraft.Client/BubbleParticle.cpp new file mode 100644 index 00000000..2d1380eb --- /dev/null +++ b/Minecraft.Client/BubbleParticle.cpp @@ -0,0 +1,41 @@ +#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+(float)(Math::random()*2-1)*0.02f; + yd = ya*0.2f+(float)(Math::random()*2-1)*0.02f; + zd = za*0.2f+(float)(Math::random()*2-1)*0.02f; + + lifetime = (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(); +}
\ No newline at end of file |
