3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 19:10:09 +01:00

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

Dieser Commit ist enthalten in:
ForceUpdate1 2020-10-12 00:24:06 +02:00 committet von GitHub
Ursprung 6eda4251f3
Commit 217702d573
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -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));
+ }); + });
+ } + }
+ +