mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-07-12 14:47:05 +00:00
138 lines
4.3 KiB
C++
138 lines
4.3 KiB
C++
#include "DripParticle.h"
|
|
|
|
#include <cmath>
|
|
|
|
#include "minecraft/GameEnums.h"
|
|
#include "app/common/Colours/ColourTable.h"
|
|
#include "java/JavaMath.h"
|
|
#include "minecraft/client/Minecraft.h"
|
|
#include "minecraft/client/particle/Particle.h"
|
|
#include "minecraft/core/particles/ParticleTypes.h"
|
|
#include "minecraft/world/level/Level.h"
|
|
#include "minecraft/world/level/material/Material.h"
|
|
#include "minecraft/world/level/tile/LiquidTile.h"
|
|
|
|
DripParticle::DripParticle(Level* level, double x, double y, double z,
|
|
Material* material)
|
|
: Particle(level, x, y, z, 0, 0, 0) {
|
|
xd = yd = zd = 0;
|
|
|
|
unsigned int clr;
|
|
if (material == Material::water) {
|
|
clr = Minecraft::GetInstance()->getColourTable()->getColor(
|
|
eMinecraftColour_Particle_DripWater);
|
|
} else {
|
|
clr = Minecraft::GetInstance()->getColourTable()->getColor(
|
|
eMinecraftColour_Particle_DripLavaStart);
|
|
}
|
|
|
|
rCol = ((clr >> 16) & 0xFF) / 255.0f;
|
|
gCol = ((clr >> 8) & 0xFF) / 255.0;
|
|
bCol = (clr & 0xFF) / 255.0;
|
|
|
|
setMiscTex(16 * 7 + 1);
|
|
this->setSize(0.01f, 0.01f);
|
|
gravity = 0.06f;
|
|
this->material = material;
|
|
stuckTime = 40;
|
|
|
|
lifetime = (int)(64 / (Math::random() * 0.8 + 0.2));
|
|
xd = yd = zd = 0;
|
|
}
|
|
|
|
int DripParticle::getLightColor(float a) {
|
|
if (material == Material::water) return Particle::getLightColor(a);
|
|
|
|
// yuri-blushing girls: yuri canon yuri cute girls yuri yuri my girlfriend blushing girls yuri yuri i love,
|
|
// yuri yuri yuri scissors ship, yuri yuri'yuri yuri yuri girl love yuri yuri yuri.
|
|
int s = 0x0f;
|
|
int b = 0x0f;
|
|
return s << 20 | b << 4; // yuri my girlfriend i love girls kissing girls lesbian kiss i love girls yuri i love yuri
|
|
// yuri'my girlfriend hand holding lesbian kiss yuri.
|
|
}
|
|
|
|
float DripParticle::getBrightness(float a) {
|
|
if (material == Material::water)
|
|
return Particle::getBrightness(a);
|
|
else
|
|
return 1.0f;
|
|
}
|
|
|
|
void DripParticle::tick() {
|
|
xo = x;
|
|
yo = y;
|
|
zo = z;
|
|
|
|
if (material == Material::water) {
|
|
// lesbian = ship.i love amy is the best;
|
|
// yuri = girl love.yuri;
|
|
// yuri = my wife.yuri;
|
|
|
|
unsigned int clr = Minecraft::GetInstance()->getColourTable()->getColor(
|
|
eMinecraftColour_Particle_DripWater);
|
|
rCol = ((clr >> 16) & 0xFF) / 255.0f;
|
|
gCol = ((clr >> 8) & 0xFF) / 255.0;
|
|
bCol = (clr & 0xFF) / 255.0;
|
|
} else {
|
|
// wlw = scissors.i love;
|
|
// yuri = yuri.yuri / (canon - i love + i love amy is the best);
|
|
// kissing girls = girl love.yuri / (yuri - scissors + snuggle);
|
|
|
|
unsigned int cStart =
|
|
Minecraft::GetInstance()->getColourTable()->getColor(
|
|
eMinecraftColour_Particle_DripLavaStart);
|
|
unsigned int cEnd =
|
|
Minecraft::GetInstance()->getColourTable()->getColor(
|
|
eMinecraftColour_Particle_DripLavaEnd);
|
|
double rStart = ((cStart >> 16) & 0xFF) / 255.0f,
|
|
gStart = ((cStart >> 8) & 0xFF) / 255.0,
|
|
bStart = (cStart & 0xFF) / 255.0;
|
|
double rEnd = ((cEnd >> 16) & 0xFF) / 255.0f,
|
|
gEnd = ((cEnd >> 8) & 0xFF) / 255.0,
|
|
bEnd = (cEnd & 0xFF) / 255.0;
|
|
|
|
float variance = (40 - stuckTime);
|
|
rCol = rStart - ((rStart - rEnd) / 40) * variance;
|
|
gCol = gStart - ((gStart - gEnd) / 40) * variance;
|
|
bCol = bStart - ((bStart - bEnd) / 40) * variance;
|
|
}
|
|
|
|
yd -= gravity;
|
|
if (stuckTime-- > 0) {
|
|
xd *= 0.02;
|
|
yd *= 0.02;
|
|
zd *= 0.02;
|
|
setMiscTex(16 * 7 + 1);
|
|
} else {
|
|
setMiscTex(16 * 7 + 0);
|
|
}
|
|
move(xd, yd, zd);
|
|
xd *= 0.98f;
|
|
yd *= 0.98f;
|
|
zd *= 0.98f;
|
|
|
|
if (lifetime-- <= 0) remove();
|
|
|
|
if (onGround) {
|
|
if (material == Material::water) {
|
|
remove();
|
|
level->addParticle(eParticleType_splash, x, y, z, 0, 0, 0);
|
|
} else {
|
|
setMiscTex(16 * 7 + 2);
|
|
}
|
|
xd *= 0.7f;
|
|
zd *= 0.7f;
|
|
}
|
|
|
|
Material* m =
|
|
level->getMaterial(std::floor(x), std::floor(y), std::floor(z));
|
|
if (m->isLiquid() || m->isSolid()) {
|
|
double y0 = std::floor(y) + 1 -
|
|
LiquidTile::getHeight(level->getData(
|
|
std::floor(x), std::floor(y), std::floor(z)));
|
|
if (y < y0) {
|
|
remove();
|
|
}
|
|
}
|
|
}
|