Fix configurable feature seed patch

This commit is contained in:
Nassim Jahnke 2021-11-26 15:17:28 +01:00
parent 1010877ebc
commit 51ffe68a94

View file

@ -83,28 +83,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -0,0 +0,0 @@ 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) {
@@ -0,0 +0,0 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource {
for (iterator = list1.iterator(); iterator.hasNext(); ++i1) {
StructureFeature<?> structuregenerator = (StructureFeature) iterator.next();
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);