From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Martijn Muijsers 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) Gale - https://galemc.org This patch is based on the following patch: "Move ThreadUnsafeRandom Initialization" By: Kevin Raneri 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 7ec3570c1759f9c7f857fcb74cd397fea14dcd91..e38cd60ba31129ed53c8c3839fedd6f77440f4b1 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -956,7 +956,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 8c3c92e2a666bcfb88aaff4ca36507e6ea20afc5..c434d73f69cf39d2139a2e71605575733c8c4752 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -184,6 +184,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public final Map explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions public java.util.ArrayDeque 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 getDimensionKey(DimensionType manager) {