mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-17 20:10:23 +03:00
* Initial commit.
:)
This commit is contained in:
33
source/World/Particle/BubbleParticle.cpp
Normal file
33
source/World/Particle/BubbleParticle.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "Particle.hpp"
|
||||
#include "Level.hpp"
|
||||
|
||||
BubbleParticle::BubbleParticle(Level* level, float x, float y, float z, float vx, float vy, float vz) :
|
||||
Particle(level, x, y, z, vx, vy, vz)
|
||||
{
|
||||
field_F8 = field_FC = field_100 = 1.0f;
|
||||
field_DC = PTI_BUBBLE;
|
||||
setSize(0.02f, 0.02f);
|
||||
|
||||
field_F0 *= 0.2f + 0.6f * sharedRandom.nextFloat();
|
||||
m_vel.x = vx * 0.2f + 0.02f * (2.0f * Mth::random() - 1.0f);
|
||||
m_vel.y = vy * 0.2f + 0.02f * (2.0f * Mth::random() - 1.0f);
|
||||
m_vel.z = vz * 0.2f + 0.02f * (2.0f * Mth::random() - 1.0f);
|
||||
field_EC = int(8.0f / (Mth::random() * 0.8f + 0.2f));
|
||||
}
|
||||
|
||||
void BubbleParticle::tick()
|
||||
{
|
||||
field_3C = m_pos;
|
||||
|
||||
m_vel.y += 0.002f;
|
||||
move(m_vel.x, m_vel.y, m_vel.z);
|
||||
|
||||
m_vel *= 0.85f;
|
||||
|
||||
if (m_pLevel->getMaterial(Mth::floor(m_pos.x), Mth::floor(m_pos.y), Mth::floor(m_pos.z)) != Material::water)
|
||||
remove();
|
||||
|
||||
field_EC--;
|
||||
if (field_EC <= 0)
|
||||
remove();
|
||||
}
|
||||
Reference in New Issue
Block a user