9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-19 14:59:29 +00:00
Files
Gale/patches/server/0010-Move-random-tick-random.patch
2022-11-25 18:43:23 +01:00

45 lines
2.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MartijnMuijsers <martijnmuijsers@live.nl>
Date: Wed, 23 Nov 2022 16:53:40 +0100
Subject: [PATCH] Move random tick random
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
This patch is based on the following patch:
"Move ThreadUnsafeRandom Initialization"
By: Kevin Raneri <kevin.raneri@gmail.com>
As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
* Pufferfish description *
ThreadUnsafeRandom is initialized too late and some of our patches
require it to be initialized earlier. By moving it to the superclass, we
initialize it earlier, ensuring that it is available sooner.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 4b7058dc684d15a782455dd52a4d57e21ba18592..f7214b2a9bc8e8514477f1434a829a82da1e50d6 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -792,7 +792,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
// Paper start - optimise random block ticking
private final BlockPos.MutableBlockPos chunkTickMutablePosition = new BlockPos.MutableBlockPos();
- private final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(this.random.nextLong());
// Paper end
public void tickChunk(LevelChunk chunk, int randomTickSpeed) {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index fbc55bb3bbde16a70bce38cb73f69867dce44a98..76a6e5d1230e2f68f7ff9c0e3f54762050f24f03 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -180,6 +180,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
public java.util.ArrayDeque<net.minecraft.world.level.block.RedstoneTorchBlock.Toggle> redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here
+ public final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(this.random.nextLong()); // Gale - Pufferfish - move random tick random
+
// Paper start - fix and optimise world upgrading
// copied from below
public static ResourceKey<DimensionType> getDimensionKey(DimensionType manager) {