This repository has been archived by the owner on Aug 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create 0166-Patch-RNG-reuse-that-could-lead-to-coord-exploit-Ran.patch
- Loading branch information
MISHA
authored
Apr 19, 2024
1 parent
899c2f4
commit 4d96378
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
patches/server/0166-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,35 @@ | ||
From 0000000000000000000000000000000000000000 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) | ||
|
||
Credits: Leijurv (From https://github.com/spawnmason/randar-explanation/blob/master/media/0386-Patch-RNG-reuse-that-could-lead-to-coord-exploit-Ran.patch) | ||
|
||
diff --git src/main/java/net/minecraft/server/World.java src/main/java/net/minecraft/server/World.java | ||
index cc9f467cc85704d536545aa63985340013e63703..a6e97eb3b57e65abf4399acbec9393bcab1ee2b9 100644 | ||
--- src/main/java/net/minecraft/server/World.java | ||
+++ 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(); | ||
+ // Dionysus start | ||
+ private final Random separateRandOnlyForWorldGen = new Random(); | ||
+ // Dionysus end | ||
public WorldProvider worldProvider; | ||
protected NavigationListener t = new NavigationListener(); | ||
protected List<IWorldAccess> u; | ||
@@ -3224,9 +3227,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; | ||
+ // Dionysus start | ||
+ this.separateRandOnlyForWorldGen.setSeed(l); | ||
+ return this.separateRandOnlyForWorldGen; | ||
+ // Dionysus end | ||
} | ||
|
||
public CrashReportSystemDetails a(CrashReport crashreport) { |