forked from spawnmason/randar-explanation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0386-Patch-RNG-reuse-that-could-lead-to-coord-exploit-Ran.patch
37 lines (32 loc) · 1.4 KB
/
0386-Patch-RNG-reuse-that-could-lead-to-coord-exploit-Ran.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From eb0276ce90794a32825d71108f69f412268c6263 Mon Sep 17 00:00:00 2001
From: Leijurv <[email protected]>
Date: Tue, 16 Apr 2024 19:43:08 -0700
Subject: [PATCH] Patch RNG reuse that could lead to coord exploit (Randar)
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index bc231c7f2..92c3e25f0 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -89,6 +89,9 @@ public abstract class World implements IBlockAccess {
protected float q;
private int M;
public final Random random = new Random();
+ // Paper start
+ private final Random separateRandOnlyForWorldGen = new Random();
+ // Paper end
public WorldProvider worldProvider;
protected NavigationListener t = new NavigationListener();
protected List<IWorldAccess> u;
@@ -3167,9 +3170,10 @@ public abstract class World implements IBlockAccess {
public Random a(int i, int j, int k) {
long l = (long) i * 341873128712L + (long) j * 132897987541L + this.getWorldData().getSeed() + (long) k;
-
- this.random.setSeed(l);
- return this.random;
+ // Paper start
+ this.separateRandOnlyForWorldGen.setSeed(l);
+ return this.separateRandOnlyForWorldGen;
+ // Paper end
}
public CrashReportSystemDetails a(CrashReport crashreport) {
--
2.37.0 (Apple Git-136)