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