diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/makamys/neodymium/renderer/Comparators.java | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/src/main/java/makamys/neodymium/renderer/Comparators.java b/src/main/java/makamys/neodymium/renderer/Comparators.java index 61dc1bc..f72cad9 100644 --- a/src/main/java/makamys/neodymium/renderer/Comparators.java +++ b/src/main/java/makamys/neodymium/renderer/Comparators.java @@ -2,58 +2,9 @@ package makamys.neodymium.renderer; import java.util.Comparator; -import net.minecraft.entity.Entity; -import net.minecraft.world.ChunkCoordIntPair; - public class Comparators { public static final MeshDistanceComparator MESH_DISTANCE_COMPARATOR = new MeshDistanceComparator(); - public static class NeoChunkComparator implements Comparator<NeoChunk> { - Entity player; - - public NeoChunkComparator(Entity player) { - this.player = player; - } - - @Override - public int compare(NeoChunk p1, NeoChunk p2) { - int distSq1 = distSq(p1); - int distSq2 = distSq(p2); - return distSq1 < distSq2 ? -1 : distSq1 > distSq2 ? 1 : 0; - } - - int distSq(NeoChunk p) { - return (int)( - Math.pow(((p.x * 16) - player.chunkCoordX), 2) + - Math.pow(((p.z * 16) - player.chunkCoordZ), 2) - ); - } - } - - public static class ChunkCoordDistanceComparator implements Comparator<ChunkCoordIntPair> { - double x, y, z; - - public ChunkCoordDistanceComparator(double x, double y, double z) { - this.x = x; - this.y = y; - this.z = z; - } - - @Override - public int compare(ChunkCoordIntPair p1, ChunkCoordIntPair p2) { - int distSq1 = distSq(p1); - int distSq2 = distSq(p2); - return distSq1 < distSq2 ? -1 : distSq1 > distSq2 ? 1 : 0; - } - - int distSq(ChunkCoordIntPair p) { - return (int)( - Math.pow(((p.chunkXPos * 16) - x), 2) + - Math.pow(((p.chunkZPos * 16) - z), 2) - ); - } - } - public static class MeshDistanceComparator implements Comparator<Mesh> { double x, y, z; boolean inverted; |