9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-31 04:46:38 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0258-Fast-BiomeManager-seed-obfuscation.patch
Dreeam f5b95a6716 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@b0da38c2 Repository details in RuntimeException for MavenLibraryResolver#addRepository (#12939)
PaperMC/Paper@1922be90 Update custom tags (#12183)
PaperMC/Paper@79cf1353 Ignore HopperInventorySearchEvent when it has no listeners (#13009)
PaperMC/Paper@ea014f7a feat: add stuckEntityPoiRetryDelay config (#12949)
PaperMC/Paper@a9e76749 Support for showNotification in PlayerRecipeDiscoverEvent (#12992)
PaperMC/Paper@5622c9dd Expose attribute sentiment (#12974)
PaperMC/Paper@42b653b1 Expose more argument types (#12665)
PaperMC/Paper@52d9a221 [ci/skip] Fix typo in Display javadoc (#13010)
PaperMC/Paper@614e9acf Improve APIs around riptide tridents (#12996)
PaperMC/Paper@51706e5a Fixed DyeItem sheep dye hunk
2025-08-25 15:52:00 -04:00

32 lines
1.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
Date: Tue, 9 Nov 2077 00:00:00 +0800
Subject: [PATCH] Fast BiomeManager seed obfuscation
Pretty tiny optimization, but better than nothing
diff --git a/net/minecraft/world/level/biome/BiomeManager.java b/net/minecraft/world/level/biome/BiomeManager.java
index b8a0fa20101fa3831e34494fd56690343ff8d57e..74cfd72d756c0b877adc27ad5b2d83e5240d3e75 100644
--- a/net/minecraft/world/level/biome/BiomeManager.java
+++ b/net/minecraft/world/level/biome/BiomeManager.java
@@ -34,9 +34,18 @@ public class BiomeManager {
// Leaf end - cache getBiome
}
+ // Leaf start - Replace SHA-256 with XXHash
+ private static final net.jpountz.xxhash.XXHash64 XXHASH = net.jpountz.xxhash.XXHashFactory.fastestInstance().hash64();
public static long obfuscateSeed(long seed) {
- return Hashing.sha256().hashLong(seed).asLong();
+ if (org.dreeam.leaf.config.modules.opt.FastBiomeManagerSeedObfuscation.enabled) {
+ java.nio.ByteBuffer buf = java.nio.ByteBuffer.allocate(8);
+ buf.putLong(0, seed);
+ return XXHASH.hash(buf, org.dreeam.leaf.config.modules.opt.FastBiomeManagerSeedObfuscation.seedObfuscationKey);
+ } else {
+ return Hashing.sha256().hashLong(seed).asLong();
+ }
}
+ // Leaf end - Replace SHA-256 with XXHash
public BiomeManager withDifferentSource(BiomeManager.NoiseBiomeSource newSource) {
return new BiomeManager(newSource, this.biomeZoomSeed);