Skip to content

Commit

Permalink
Patch RNG reuse that could lead to coord exploit (Randar)
Browse files Browse the repository at this point in the history
  • Loading branch information
leijurv committed Apr 17, 2024
1 parent e39995d commit a5cd8a5
Showing 1 changed file with 37 additions and 0 deletions.
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)

0 comments on commit a5cd8a5

Please sign in to comment.