Fix distance in checkHighPriorityChunks (Fixes #4582) (#4605)

This commit is contained in:
ForceUpdate1 2020-10-12 00:24:06 +02:00 committed by GitHub
parent 6eda4251f3
commit 217702d573
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 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 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/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; @@ -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); + double dist = MCUtil.distance(playerChunkX, 0, playerChunkZ, coord.x, 0, coord.z);
+ // Prioritize immediate + // Prioritize immediate
+ if (dist <= 4 * 4) { + if (dist <= 4) {
+ updateChunkPriorityMap(priorities, coord.pair(), (int) (27 - Math.sqrt(dist))); + updateChunkPriorityMap(priorities, coord.pair(), (int) (27 - dist));
+ return; + return;
+ } + }
+ +
+ // Prioritize nearby chunks + // 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 + // Prioritize Frustum near 3
@ -1040,7 +1040,7 @@ index fba7c9b5724114eab35a3d24febdee3cd3e30aa0..753d67c8a711d293bd70eb913c47ec81
+ if (shouldSkipPrioritization(coord)) return; + if (shouldSkipPrioritization(coord)) return;
+ +
+ double dist = MCUtil.distance(playerChunkX, 0, playerChunkZ, coord.x, 0, coord.z); + 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 + // Prioritize Frustum near 5
@ -1051,7 +1051,7 @@ index fba7c9b5724114eab35a3d24febdee3cd3e30aa0..753d67c8a711d293bd70eb913c47ec81
+ if (shouldSkipPrioritization(coord)) return; + if (shouldSkipPrioritization(coord)) return;
+ +
+ double dist = MCUtil.distance(playerChunkX, 0, playerChunkZ, coord.x, 0, coord.z); + 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; + return;
+ } + }
+ double dist = MCUtil.distance(playerChunkX, 0, playerChunkZ, coord.x, 0, coord.z); + 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));
+ }); + });
+ } + }
+ +