the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "DirtyChunkSorter.h"
3#include "../Minecraft.World/net.minecraft.world.entity.player.h"
4#include "Chunk.h"
5
6DirtyChunkSorter::DirtyChunkSorter(shared_ptr<LivingEntity> cameraEntity, int playerIndex) // 4J - added player index
7{
8 this->cameraEntity = cameraEntity;
9 this->playerIndex = playerIndex;
10}
11
12bool DirtyChunkSorter::operator()(const Chunk *c0, const Chunk *c1) const
13{
14 bool i0 = c0->clipChunk->visible;
15 bool i1 = c1->clipChunk->visible;
16 if (i0 && !i1) return false;
17 if (i1 && !i0) return true;
18
19 double d0 = c0->distanceToSqr(cameraEntity);
20 double d1 = c1->distanceToSqr(cameraEntity);
21
22 if (d0 < d1) return false;
23 if (d0 > d1) return true;
24
25 return c0->id >= c1->id; // 4J - was c0.id < c1.id ? 1 : -1
26}