From 217702d57325bd5593b645e9d96cf7d8a5e3741d Mon Sep 17 00:00:00 2001 From: ForceUpdate1 Date: Mon, 12 Oct 2020 00:24:06 +0200 Subject: [PATCH] Fix distance in checkHighPriorityChunks (Fixes #4582) (#4605) --- ...-Chunk-Priority-Urgency-System-for-Chunks.patch | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Spigot-Server-Patches/0488-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch b/Spigot-Server-Patches/0488-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch index 760fdb128..8d74995c2 100644 --- a/Spigot-Server-Patches/0488-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch +++ b/Spigot-Server-Patches/0488-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch @@ -889,7 +889,7 @@ index 078cbc9f4dbd387ef1088c76b2f77ee47fff135d..ca9e0208aa35c597a947485f67213ff4 } diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index fba7c9b5724114eab35a3d24febdee3cd3e30aa0..753d67c8a711d293bd70eb913c47ec817e2718e3 100644 +index fba7c9b5724114eab35a3d24febdee3cd3e30aa0..b6ae589548bdc75052f4986069b3374cb5fd837c 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -14,6 +14,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; @@ -1024,13 +1024,13 @@ index fba7c9b5724114eab35a3d24febdee3cd3e30aa0..753d67c8a711d293bd70eb913c47ec81 + + double dist = MCUtil.distance(playerChunkX, 0, playerChunkZ, coord.x, 0, coord.z); + // Prioritize immediate -+ if (dist <= 4 * 4) { -+ updateChunkPriorityMap(priorities, coord.pair(), (int) (27 - Math.sqrt(dist))); ++ if (dist <= 4) { ++ updateChunkPriorityMap(priorities, coord.pair(), (int) (27 - dist)); + return; + } + + // Prioritize nearby chunks -+ updateChunkPriorityMap(priorities, coord.pair(), (int) (20 - Math.sqrt(dist) * twoThirdModifier)); ++ updateChunkPriorityMap(priorities, coord.pair(), (int) (20 - dist * twoThirdModifier)); + }); + + // Prioritize Frustum near 3 @@ -1040,7 +1040,7 @@ index fba7c9b5724114eab35a3d24febdee3cd3e30aa0..753d67c8a711d293bd70eb913c47ec81 + if (shouldSkipPrioritization(coord)) return; + + double dist = MCUtil.distance(playerChunkX, 0, playerChunkZ, coord.x, 0, coord.z); -+ updateChunkPriorityMap(priorities, coord.pair(), (int) (25 - Math.sqrt(dist) * twoThirdModifier)); ++ updateChunkPriorityMap(priorities, coord.pair(), (int) (25 - dist * twoThirdModifier)); + }); + + // Prioritize Frustum near 5 @@ -1051,7 +1051,7 @@ index fba7c9b5724114eab35a3d24febdee3cd3e30aa0..753d67c8a711d293bd70eb913c47ec81 + if (shouldSkipPrioritization(coord)) return; + + double dist = MCUtil.distance(playerChunkX, 0, playerChunkZ, coord.x, 0, coord.z); -+ updateChunkPriorityMap(priorities, coord.pair(), (int) (25 - Math.sqrt(dist) * twoThirdModifier)); ++ updateChunkPriorityMap(priorities, coord.pair(), (int) (25 - dist * twoThirdModifier)); + }); + } + @@ -1064,7 +1064,7 @@ index fba7c9b5724114eab35a3d24febdee3cd3e30aa0..753d67c8a711d293bd70eb913c47ec81 + return; + } + double dist = MCUtil.distance(playerChunkX, 0, playerChunkZ, coord.x, 0, coord.z); -+ updateChunkPriorityMap(priorities, coord.pair(), (int) (25 - Math.sqrt(dist) * twoThirdModifier)); ++ updateChunkPriorityMap(priorities, coord.pair(), (int) (25 - dist * twoThirdModifier)); + }); + } +