mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-28 19:19:09 +00:00
47 lines
2.7 KiB
Diff
47 lines
2.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martijn Muijsers <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)
|
|
Gale - https://galemc.org
|
|
|
|
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 3401602c57337e96012c2768b38f523ca7dd6798..91042db25973e6a9fefebef2bc8f1471ddf34e58 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -836,8 +836,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
}
|
|
|
|
// Paper start - optimise random ticking
|
|
- private final ca.spottedleaf.moonrise.common.util.SimpleRandom simpleRandom = new ca.spottedleaf.moonrise.common.util.SimpleRandom(0L);
|
|
-
|
|
private void optimiseRandomTick(final LevelChunk chunk, final int tickSpeed) {
|
|
final LevelChunkSection[] sections = chunk.getSections();
|
|
final int minSection = ca.spottedleaf.moonrise.common.util.WorldUtil.getMinSection((ServerLevel)(Object)this);
|
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
|
index 38408c004bdf8e31ad8665f75205a0f42ef1ff99..f40d3ef570eb7d079d30f88470d95b3de12695ee 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
|
@@ -183,6 +183,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
|
public final Map<ServerExplosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
|
|
public java.util.ArrayDeque<net.minecraft.world.level.block.RedstoneTorchBlock.Toggle> redstoneUpdateInfos; // Paper - Faster redstone torch rapid clock removal; Move from Map in BlockRedstoneTorch to here
|
|
|
|
+ public final ca.spottedleaf.moonrise.common.util.SimpleRandom simpleRandom = new ca.spottedleaf.moonrise.common.util.SimpleRandom(0L); // Gale - Pufferfish - move random tick random
|
|
+
|
|
public CraftWorld getWorld() {
|
|
return this.world;
|
|
}
|