chore: format Minecraft.Client

This commit is contained in:
Tropical
2026-03-13 17:10:10 -05:00
parent 33d0737d1d
commit e8424f2000
531 changed files with 67709 additions and 62690 deletions

View File

@@ -5,71 +5,84 @@
#include "../../../Minecraft.World/Headers/net.minecraft.world.level.h"
#include "../../../Minecraft.World/Headers/net.minecraft.world.h"
TerrainParticle::TerrainParticle(Level *level, double x, double y, double z, double xa, double ya, double za, Tile *tile, int face, int data, Textures *textures) : Particle(level, x, y, z, xa, ya, za)
{
TerrainParticle::TerrainParticle(Level* level, double x, double y, double z,
double xa, double ya, double za, Tile* tile,
int face, int data, Textures* textures)
: Particle(level, x, y, z, xa, ya, za) {
this->tile = tile;
this->setTex(textures, tile->getTexture(0, data)); // 4J - change brought forward from 1.8.2 to fix purple particles on door damage
this->setTex(
textures,
tile->getTexture(0, data)); // 4J - change brought forward from 1.8.2
// to fix purple particles on door damage
this->gravity = tile->gravity;
rCol = gCol = bCol = 0.6f;
size /= 2;
}
std::shared_ptr<TerrainParticle> TerrainParticle::init(int x, int y, int z, int data) // 4J - added data parameter
std::shared_ptr<TerrainParticle> TerrainParticle::init(
int x, int y, int z, int data) // 4J - added data parameter
{
if (tile == Tile::grass) return std::dynamic_pointer_cast<TerrainParticle>( shared_from_this() );
int col = tile->getColor(level, x, y, z, data); // 4J - added data parameter
if (tile == Tile::grass)
return std::dynamic_pointer_cast<TerrainParticle>(shared_from_this());
int col =
tile->getColor(level, x, y, z, data); // 4J - added data parameter
rCol *= ((col >> 16) & 0xff) / 255.0f;
gCol *= ((col >> 8) & 0xff) / 255.0f;
bCol *= ((col) & 0xff) / 255.0f;
return std::dynamic_pointer_cast<TerrainParticle>( shared_from_this() );
return std::dynamic_pointer_cast<TerrainParticle>(shared_from_this());
}
std::shared_ptr<TerrainParticle> TerrainParticle::init(int data)
{
if (tile == Tile::grass) return std::dynamic_pointer_cast<TerrainParticle>( shared_from_this() );
int col = tile->getColor(data);
rCol *= ((col >> 16) & 0xff) / 255.0f;
gCol *= ((col >> 8) & 0xff) / 255.0f;
bCol *= ((col) & 0xff) / 255.0f;
return std::dynamic_pointer_cast<TerrainParticle>( shared_from_this() );
std::shared_ptr<TerrainParticle> TerrainParticle::init(int data) {
if (tile == Tile::grass)
return std::dynamic_pointer_cast<TerrainParticle>(shared_from_this());
int col = tile->getColor(data);
rCol *= ((col >> 16) & 0xff) / 255.0f;
gCol *= ((col >> 8) & 0xff) / 255.0f;
bCol *= ((col) & 0xff) / 255.0f;
return std::dynamic_pointer_cast<TerrainParticle>(shared_from_this());
}
int TerrainParticle::getParticleTexture()
{
return ParticleEngine::TERRAIN_TEXTURE;
int TerrainParticle::getParticleTexture() {
return ParticleEngine::TERRAIN_TEXTURE;
}
void TerrainParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2)
{
void TerrainParticle::render(Tesselator* t, float a, float xa, float ya,
float za, float xa2, float za2) {
float u0 = (texX + uo / 4.0f) / 16.0f;
float u1 = u0 + 0.999f / 16.0f / 4;
float v0 = (texY + vo / 4.0f) / 16.0f;
float v1 = v0 + 0.999f / 16.0f / 4;
float r = 0.1f * size;
if (tex != NULL)
{
u0 = tex->getU((uo / 4.0f) * SharedConstants::WORLD_RESOLUTION);
u1 = tex->getU(((uo + 1) / 4.0f) * SharedConstants::WORLD_RESOLUTION);
v0 = tex->getV((vo / 4.0f) * SharedConstants::WORLD_RESOLUTION);
v1 = tex->getV(((vo + 1) / 4.0f) * SharedConstants::WORLD_RESOLUTION);
}
if (tex != NULL) {
u0 = tex->getU((uo / 4.0f) * SharedConstants::WORLD_RESOLUTION);
u1 = tex->getU(((uo + 1) / 4.0f) * SharedConstants::WORLD_RESOLUTION);
v0 = tex->getV((vo / 4.0f) * SharedConstants::WORLD_RESOLUTION);
v1 = tex->getV(((vo + 1) / 4.0f) * SharedConstants::WORLD_RESOLUTION);
}
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 = (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);
// 4J - don't render terrain particles that are less than a metre away, to try and avoid large particles that are causing us problems with
// photosensitivity testing
float distSq = (x*x + y*y + z*z);
if( distSq < 1.0f ) return;
// 4J - don't render terrain particles that are less than a metre away, to
// try and avoid large particles that are causing us problems with
// photosensitivity testing
float distSq = (x * x + y * y + z * z);
if (distSq < 1.0f) return;
float br = SharedConstants::TEXTURE_LIGHTING ? 1.0f : getBrightness(a); // 4J - change brought forward from 1.8.2
float br =
SharedConstants::TEXTURE_LIGHTING
? 1.0f
: getBrightness(a); // 4J - change brought forward from 1.8.2
t->color(br * rCol, br * gCol, br * bCol);
t->vertexUV((float)(x - xa * r - xa2 * r), (float)( y - ya * r), (float)( z - za * r - za2 * r), (float)( u0), (float)( v1));
t->vertexUV((float)(x - xa * r + xa2 * r), (float)( y + ya * r), (float)( z - za * r + za2 * r), (float)( u0), (float)( v0));
t->vertexUV((float)(x + xa * r + xa2 * r), (float)( y + ya * r), (float)( z + za * r + za2 * r), (float)( u1), (float)( v0));
t->vertexUV((float)(x + xa * r - xa2 * r), (float)( y - ya * r), (float)( z + za * r - za2 * r), (float)( u1), (float)( v1));
t->vertexUV((float)(x - xa * r - xa2 * r), (float)(y - ya * r),
(float)(z - za * r - za2 * r), (float)(u0), (float)(v1));
t->vertexUV((float)(x - xa * r + xa2 * r), (float)(y + ya * r),
(float)(z - za * r + za2 * r), (float)(u0), (float)(v0));
t->vertexUV((float)(x + xa * r + xa2 * r), (float)(y + ya * r),
(float)(z + za * r + za2 * r), (float)(u1), (float)(v0));
t->vertexUV((float)(x + xa * r - xa2 * r), (float)(y - ya * r),
(float)(z + za * r - za2 * r), (float)(u1), (float)(v1));
}