- if (structureset.placement() instanceof RandomSpreadStructurePlacement randomConfig) {
+ if (structureset.placement() instanceof RandomSpreadStructurePlacement randomConfig && this.structureSets.getKey(structureset).getNamespace().equals(net.minecraft.resources.ResourceLocation.DEFAULT_NAMESPACE)) { // Paper - check namespace cause datapacks could add structure sets with the same path
String name = this.structureSets.getKey(structureset).getPath();
int seed = randomConfig.salt;
@@ -180,6 +180,11 @@ public abstract class ChunkGenerator {
case "villages":
seed = conf.villageSeed;
break;
+ // Paper start
+ case "ancient_cities":
+ seed = conf.ancientCitySeed;
+ break;
+ // Paper end
}
structureset = new StructureSet(structureset.structures(), new RandomSpreadStructurePlacement(randomConfig.locateOffset, randomConfig.frequencyReductionMethod, randomConfig.frequency, seed, randomConfig.exclusionZone, randomConfig.spacing(), randomConfig.separation(), randomConfig.spreadType()));
@@ -236,7 +241,13 @@ public abstract class ChunkGenerator {
+ public boolean isStructureChunk(ChunkGenerator chunkGenerator, RandomState noiseConfig, long seed, int chunkX, int chunkZ, @org.jetbrains.annotations.Nullable net.minecraft.resources.ResourceLocation structureSetKey) {
+ Integer saltOverride = null;
+ if (net.minecraft.world.level.levelgen.structure.BuiltinStructureSets.MINESHAFTS.location().equals(structureSetKey)) {
@@ -77,25 +89,31 @@ public abstract class StructurePlacement {
public abstract StructurePlacementType<?> type();
- private static boolean probabilityReducer(long seed, int salt, int chunkX, int chunkZ, float frequency) {
+ private static boolean probabilityReducer(long seed, int salt, int chunkX, int chunkZ, float frequency, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - ignore here
WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L));
- private static boolean legacyProbabilityReducerWithDouble(long seed, int salt, int chunkX, int chunkZ, float frequency) {
+ private static boolean legacyProbabilityReducerWithDouble(long seed, int salt, int chunkX, int chunkZ, float frequency, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper
WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L));
- private static boolean legacyArbitrarySaltProbabilityReducer(long seed, int salt, int chunkX, int chunkZ, float frequency) {
+ private static boolean legacyArbitrarySaltProbabilityReducer(long seed, int salt, int chunkX, int chunkZ, float frequency, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper
WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L));
- private static boolean legacyPillagerOutpostReducer(long seed, int salt, int chunkX, int chunkZ, float frequency) {
+ private static boolean legacyPillagerOutpostReducer(long seed, int salt, int chunkX, int chunkZ, float frequency, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - ignore here
int i = chunkX >> 4;
int j = chunkZ >> 4;
WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L));
@@ -118,7 +136,7 @@ public abstract class StructurePlacement {
@FunctionalInterface
public interface FrequencyReducer {
- boolean shouldGenerate(long seed, int salt, int chunkX, int chunkZ, float chance);
+ boolean shouldGenerate(long seed, int salt, int chunkX, int chunkZ, float chance, @org.jetbrains.annotations.Nullable Integer saltOverride); // Paper
}
public static enum FrequencyReductionMethod implements StringRepresentable {
@@ -136,8 +154,8 @@ public abstract class StructurePlacement {
this.reducer = generationPredicate;
}
- public boolean shouldGenerate(long seed, int salt, int chunkX, int chunkZ, float chance) {
+ public boolean shouldGenerate(long seed, int salt, int chunkX, int chunkZ, float chance, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper
+ return this.reducer.shouldGenerate(seed, salt, chunkX, chunkZ, chance, saltOverride); // Paper