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 "DistanceChunkSorter.h"
3#include "../Minecraft.World/net.minecraft.world.entity.player.h"
4#include "Chunk.h"
5
6DistanceChunkSorter::DistanceChunkSorter(shared_ptr<Entity> player)
7{
8 ix = -player->x;
9 iy = -player->y;
10 iz = -player->z;
11}
12
13bool DistanceChunkSorter::operator()(const Chunk *c0, const Chunk *c1) const
14{
15 double xd0 = c0->xm + ix;
16 double yd0 = c0->ym + iy;
17 double zd0 = c0->zm + iz;
18
19 double xd1 = c1->xm + ix;
20 double yd1 = c1->ym + iy;
21 double zd1 = c1->zm + iz;
22
23 return (((xd0 * xd0 + yd0 * yd0 + zd0 * zd0) - (xd1 * xd1 + yd1 * yd1 + zd1 * zd1)) * 1024) < 0.0;
24}