Merge dev and resolve formatting conflicts

This commit is contained in:
MatthewBeshay
2026-03-30 19:00:30 +11:00
463 changed files with 12624 additions and 11227 deletions

View File

@@ -69,7 +69,6 @@
// #define DISABLE_SPU_CODE
ResourceLocation LevelRenderer::MOON_LOCATION =
ResourceLocation(TN_TERRAIN_MOON);
ResourceLocation LevelRenderer::MOON_PHASES_LOCATION =
@@ -158,7 +157,8 @@ LevelRenderer::LevelRenderer(Minecraft* mc, Textures* textures) {
totalChunks = offscreenChunks = occludedChunks = renderedChunks =
emptyChunks = 0;
for (int i = 0; i < 4; i++) {
// sortedChunks[i] = nullptr; // 4J - removed - not sorting
// sortedChunks[i] = nullptr; // 4J - removed - not
// sorting
// our chunks anymore
chunks[i] = ClipChunkArray();
lastPlayerCount[i] = 0;
@@ -471,8 +471,8 @@ void LevelRenderer::allChanged(int playerIndex) {
zMaxChunk = zChunks;
// 4J removed - we now only fully clear this on exiting the game (setting
// level to nullptr). Apart from that, the chunk rebuilding is responsible for
// maintaining this
// level to nullptr). Apart from that, the chunk rebuilding is responsible
// for maintaining this
// renderableTileEntities.clear();
for (int x = 0; x < xChunks; x++) {
@@ -560,8 +560,8 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) {
totalEntities = (int)entities.size();
auto itEndGE = level[playerIndex]->globalEntities.end();
for (auto it = level[playerIndex]->globalEntities.begin();
it != itEndGE; it++) {
for (auto it = level[playerIndex]->globalEntities.begin(); it != itEndGE;
it++) {
std::shared_ptr<Entity> entity = *it; // level->globalEntities[i];
renderedEntities++;
if (entity->shouldRender(cam))
@@ -762,10 +762,6 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha) {
glTranslatef((float)-xOff, (float)-yOff, (float)-zOff);
bool first = true;
int count = 0;
ClipChunk* pClipChunk = chunks[playerIndex].data;
@@ -830,8 +826,6 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha) {
RenderManager.SetChunkOffset(0.f, 0.f, 0.f);
}
glPopMatrix();
mc->gameRenderer->turnOffLightLayer(alpha);
@@ -928,7 +922,6 @@ void LevelRenderer::renderSky(float alpha) {
glDepthMask(false);
glEnable(GL_FOG);
glColor3f(sr, sg, sb);
glCallList(skyList);
@@ -1043,7 +1036,6 @@ void LevelRenderer::renderSky(float alpha) {
glEnable(GL_ALPHA_TEST);
glEnable(GL_FOG);
glPopMatrix();
glDisable(GL_TEXTURE_2D);
glColor3f(0, 0, 0);
@@ -1777,9 +1769,9 @@ bool LevelRenderer::updateDirtyChunks() {
// Find nearest chunk that is dirty
for (int p = 0; p < XUSER_MAX_COUNT; p++) {
// It's possible that the localplayers member can be set to nullptr
// on the main thread when a player chooses to exit the game So
// take a reference to the player object now. As it is a
// It's possible that the localplayers member can be set to
// nullptr on the main thread when a player chooses to exit the
// game So take a reference to the player object now. As it is a
// shared_ptr it should live as long as we need it
std::shared_ptr<LocalPlayer> player = mc->localplayers[p];
if (player == nullptr) continue;
@@ -2436,14 +2428,12 @@ bool inline clip(float* bb, float* frustum) {
return true;
}
// 4jcraft: optional occlusion culling system, i hope to upgrade it soon
// gives better performances but mostly breaks chunk rendering
void LevelRenderer::cull(Culler* culler, float a) {
int playerIndex = mc->player->GetXboxPad();
if (chunks[playerIndex].data == nullptr) return;
FrustumCuller* fc = (FrustumCuller*)culler;
FrustumData* fd = fc->frustum;
float fdraw[6 * 4];
@@ -2813,8 +2803,8 @@ void LevelRenderer::playSoundExceptPlayer(std::shared_ptr<Player> player,
void LevelRenderer::addParticle(const wstring& name, double x, double y, double
z, double xa, double ya, double za)
{
if (mc == nullptr || mc->cameraTargetPlayer == nullptr || mc->particleEngine == nullptr)
return;
if (mc == nullptr || mc->cameraTargetPlayer == nullptr || mc->particleEngine ==
nullptr) return;
double xd = mc->cameraTargetPlayer->x - x;
double yd = mc->cameraTargetPlayer->y - y;
@@ -2907,14 +2897,15 @@ std::shared_ptr<Particle> LevelRenderer::addParticleInternal(
}
// 4J - this is a bit of hack to get communication through from the level
// itself, but if Minecraft::animateTickLevel is nullptr then we are to behave
// as normal, and if it is set, then we should use that as a pointer to the
// level the particle is to be created with rather than try to work it out
// from the current player. This is because in this state we are calling
// from a loop that is trying to amalgamate particle creation between all
// players for a particular level. Also don't do distance clipping as it
// isn't for a particular player, and distance is already taken into account
// before we get here anyway by the code in Level::animateTickDoWork
// itself, but if Minecraft::animateTickLevel is nullptr then we are to
// behave as normal, and if it is set, then we should use that as a pointer
// to the level the particle is to be created with rather than try to work
// it out from the current player. This is because in this state we are
// calling from a loop that is trying to amalgamate particle creation
// between all players for a particular level. Also don't do distance
// clipping as it isn't for a particular player, and distance is already
// taken into account before we get here anyway by the code in
// Level::animateTickDoWork
if (mc->animateTickLevel == nullptr) {
double particleDistanceSquared = 16 * 16;
double xd = 0.0f;