-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patch RNG reuse that could lead to coord exploit (Randar)
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
Spigot-Server-Patches/0386-Patch-RNG-reuse-that-could-lead-to-coord-exploit-Ran.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
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) | ||
|