Fix configurable feature seed patch

This commit is contained in:
Nassim Jahnke 2021-11-26 15:17:28 +01:00 committed by MiniDigger | Martin
parent 9ea33aa222
commit 10c6a1bd9e

View File

@ -79,32 +79,32 @@ index e5543b3a261f80bd9b0346d595a62b5458d9b229..45abadeb2568566b3646004d03e7ba8c
return getIntOrDefault(behaviorTickRates, typeName, entityType, def);
}
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 e2b7da265e9616ac47e6be72cc6e6d2c75cfec44..f8a2aa31e38f64f88a82d5a388b58f1962d5fda0 100644
index e2b7da265e9616ac47e6be72cc6e6d2c75cfec44..e4591c0b3c8547cc6f4e2a0891fc378ee4334d9e 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -278,7 +278,7 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource {
@@ -277,7 +277,7 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource {
int j = list.size();
try {
Registry<PlacedFeature> iregistry = generatoraccessseed.registryAccess().registryOrThrow(Registry.PLACED_FEATURE_REGISTRY);
- Registry<StructureFeature<?>> iregistry1 = generatoraccessseed.registryAccess().registryOrThrow(Registry.STRUCTURE_FEATURE_REGISTRY);
+ Registry<StructureFeature<?>> iregistry1 = generatoraccessseed.registryAccess().registryOrThrow(Registry.STRUCTURE_FEATURE_REGISTRY); // Paper - diff on change
- Registry<PlacedFeature> iregistry = generatoraccessseed.registryAccess().registryOrThrow(Registry.PLACED_FEATURE_REGISTRY);
+ Registry<PlacedFeature> iregistry = generatoraccessseed.registryAccess().registryOrThrow(Registry.PLACED_FEATURE_REGISTRY); // Paper - diff on change
Registry<StructureFeature<?>> iregistry1 = generatoraccessseed.registryAccess().registryOrThrow(Registry.STRUCTURE_FEATURE_REGISTRY);
int k = Math.max(GenerationStep.Decoration.values().length, j);
for (int l = 0; l < k; ++l) {
@@ -292,7 +292,15 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource {
for (iterator = list1.iterator(); iterator.hasNext(); ++i1) {
StructureFeature<?> structuregenerator = (StructureFeature) iterator.next();
@@ -351,7 +351,15 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource {
return (String) optional.orElseGet(placedfeature::toString);
};
- seededrandom.setFeatureSeed(i, i1, l);
- seededrandom.setFeatureSeed(i, l1, l);
+ // Paper start - change populationSeed used in random
+ long featurePopulationSeed = i;
+ final net.minecraft.resources.ResourceLocation location = iregistry1.getKey(structuregenerator);
+ final net.minecraft.resources.ResourceLocation location = iregistry.getKey(placedfeature);
+ final long configFeatureSeed = generatoraccessseed.getMinecraftWorld().paperConfig.featureSeeds.getLong(location);
+ if (configFeatureSeed != -1) {
+ featurePopulationSeed = seededrandom.setDecorationSeed(configFeatureSeed, blockposition.getX(), blockposition.getZ()); // See seededrandom.setDecorationSeed from above
+ }
+ seededrandom.setFeatureSeed(featurePopulationSeed, i1, l);;
+ seededrandom.setFeatureSeed(featurePopulationSeed, l1, l);
+ // Paper end
Supplier<String> supplier = () -> { // CraftBukkit - decompile error
Optional optional = iregistry1.getResourceKey(structuregenerator).map(Object::toString);
try {
generatoraccessseed.setCurrentlyGenerating(supplier1);