mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 21:17:00 +01:00
286bd1bfb5
- Port player chunk loader patch Makes the chunk system act as it did in 1.17, no additional tickets (and thus logic) to make a chunk ticking. Adds simulation distance API, deprecates old no-tick method. - More collision optimisations Ancient patch from tuinity that never could be pushed to master. - Fix Optimise ArraySetSorted#removeIf patch - Execute chunk tasks fairly for worlds while waiting for next tick - Port Replace ticket level propagator
25 lines
1.2 KiB
Diff
25 lines
1.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Nassim Jahnke <jahnke.nassim@gmail.com>
|
|
Date: Tue, 11 Jan 2022 19:31:46 +0100
|
|
Subject: [PATCH] Fix int overflow in chunk range check
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
index 79dbffe899dd7e31af648302c557e2993f170623..6a035b173cf0d288b2912f568078fede45d138f2 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
@@ -622,9 +622,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
public static boolean isChunkInRange(int x1, int z1, int x2, int z2, int distance) {
|
|
int j1 = Math.max(0, Math.abs(x1 - x2) - 1);
|
|
int k1 = Math.max(0, Math.abs(z1 - z2) - 1);
|
|
- int l1 = Math.max(0, Math.max(j1, k1) - 1);
|
|
- int i2 = Math.min(j1, k1);
|
|
- int j2 = i2 * i2 + l1 * l1;
|
|
+ // Paper start - fix integer overflow
|
|
+ long l1 = Math.max(0, Math.max(j1, k1) - 1);
|
|
+ long i2 = Math.min(j1, k1);
|
|
+ long j2 = i2 * i2 + l1 * l1;
|
|
+ // Paper end
|
|
int k2 = distance - 1;
|
|
int l2 = k2 * k2;
|
|
|