mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-19 14:59:29 +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/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
|
index 93b0265e3b1ea133877682721ff28d735d9b688b..e43fa760210cb4c956b2143a65452eecf5f923f4 100644
|
|
--- a/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/net/minecraft/server/level/ServerLevel.java
|
|
@@ -841,8 +841,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
}
|
|
|
|
// Paper start - optimise random ticking
|
|
- private final ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom simpleRandom = new ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom(net.minecraft.world.level.levelgen.RandomSupport.generateUniqueSeed());
|
|
-
|
|
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/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
|
|
index 73678ed00529af2369c66900c948de5fb46cc128..c4563e827a8333d57aabce1ff8e4c28d7e3a295b 100644
|
|
--- a/net/minecraft/world/level/Level.java
|
|
+++ b/net/minecraft/world/level/Level.java
|
|
@@ -181,6 +181,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.SimpleThreadUnsafeRandom simpleRandom = new ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom(net.minecraft.world.level.levelgen.RandomSupport.generateUniqueSeed()); // Gale - Pufferfish - move random tick random
|
|
+
|
|
public CraftWorld getWorld() {
|
|
return this.world;
|
|
}
|