diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/DistanceChunkSorter.cpp | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.Client/DistanceChunkSorter.cpp')
| -rw-r--r-- | Minecraft.Client/DistanceChunkSorter.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Minecraft.Client/DistanceChunkSorter.cpp b/Minecraft.Client/DistanceChunkSorter.cpp new file mode 100644 index 00000000..80ac0cdf --- /dev/null +++ b/Minecraft.Client/DistanceChunkSorter.cpp @@ -0,0 +1,24 @@ +#include "stdafx.h" +#include "DistanceChunkSorter.h" +#include "../Minecraft.World/net.minecraft.world.entity.player.h" +#include "Chunk.h" + +DistanceChunkSorter::DistanceChunkSorter(shared_ptr<Entity> player) +{ + ix = -player->x; + iy = -player->y; + iz = -player->z; +} + +bool DistanceChunkSorter::operator()(const Chunk *c0, const Chunk *c1) const +{ + double xd0 = c0->xm + ix; + double yd0 = c0->ym + iy; + double zd0 = c0->zm + iz; + + double xd1 = c1->xm + ix; + double yd1 = c1->ym + iy; + double zd1 = c1->zm + iz; + + return (((xd0 * xd0 + yd0 * yd0 + zd0 * zd0) - (xd1 * xd1 + yd1 * yd1 + zd1 * zd1)) * 1024) < 0.0; +}
\ No newline at end of file |
