aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0619-Configurable-feature-seeds.patch
blob: b374cbddbfec1ac5f5385b7e2730773490c09c33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Tue, 31 Aug 2021 17:05:27 +0200
Subject: [PATCH] Configurable feature seeds

Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com>

diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
index e3c5a49611d584fbd19a44da5aa78ff6d7c43881..fc8e3edd9734fa7b69f0fc6b4eefd8a704e451cf 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -436,7 +436,14 @@ public abstract class ChunkGenerator {
                                 return (String) optional.orElseGet(placedfeature::toString);
                             };
 
-                            seededrandom.setFeatureSeed(i, l1, l);
+                            // Paper start - Configurable feature seeds; change populationSeed used in random
+                            long featurePopulationSeed = i;
+                            final long configFeatureSeed = generatoraccessseed.getMinecraftWorld().paperConfig().featureSeeds.features.getLong(placedfeature.feature());
+                            if (configFeatureSeed != -1) {
+                                featurePopulationSeed = seededrandom.setDecorationSeed(configFeatureSeed, blockposition.getX(), blockposition.getZ()); // See seededrandom.setDecorationSeed from above
+                            }
+                            seededrandom.setFeatureSeed(featurePopulationSeed, l1, l);
+                            // Paper end - Configurable feature seeds
 
                             try {
                                 generatoraccessseed.setCurrentlyGenerating(supplier1);