some more directories

This commit is contained in:
Jake Potrebic
2024-12-13 09:24:26 -08:00
parent 1ed5242f38
commit e9b739bc48
8 changed files with 222 additions and 115 deletions

View File

@@ -0,0 +1,93 @@
--- a/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java
+++ b/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java
@@ -79,14 +_,30 @@
return this.exclusionZone;
}
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - Add missing structure set seed configs
public boolean isStructureChunk(ChunkGeneratorStructureState structureState, int x, int z) {
+ // Paper start - Add missing structure set seed configs
+ return this.isStructureChunk(structureState, x, z, null);
+ }
+ public boolean isStructureChunk(ChunkGeneratorStructureState structureState, int x, int z, @org.jetbrains.annotations.Nullable net.minecraft.resources.ResourceKey<StructureSet> structureSetKey) {
+ Integer saltOverride = null;
+ if (structureSetKey != null) {
+ if (structureSetKey == net.minecraft.world.level.levelgen.structure.BuiltinStructureSets.MINESHAFTS) {
+ saltOverride = structureState.conf.mineshaftSeed;
+ } else if (structureSetKey == net.minecraft.world.level.levelgen.structure.BuiltinStructureSets.BURIED_TREASURES) {
+ saltOverride = structureState.conf.buriedTreasureSeed;
+ }
+ }
+ // Paper end - Add missing structure set seed configs
return this.isPlacementChunk(structureState, x, z)
- && this.applyAdditionalChunkRestrictions(x, z, structureState.getLevelSeed())
+ && this.applyAdditionalChunkRestrictions(x, z, structureState.getLevelSeed(), saltOverride) // Paper - Add missing structure set seed configs
&& this.applyInteractionsWithOtherStructures(structureState, x, z);
}
- public boolean applyAdditionalChunkRestrictions(int regionX, int regionZ, long levelSeed) {
- return !(this.frequency < 1.0F) || this.frequencyReductionMethod.shouldGenerate(levelSeed, this.salt, regionX, regionZ, this.frequency);
+ // Paper start - Add missing structure set seed configs
+ public boolean applyAdditionalChunkRestrictions(int regionX, int regionZ, long levelSeed, @org.jetbrains.annotations.Nullable Integer saltOverride) {
+ return !(this.frequency < 1.0F) || this.frequencyReductionMethod.shouldGenerate(levelSeed, this.salt, regionX, regionZ, this.frequency, saltOverride);
+ // Paper end - Add missing structure set seed configs
}
public boolean applyInteractionsWithOtherStructures(ChunkGeneratorStructureState structureState, int x, int z) {
@@ -101,25 +_,31 @@
public abstract StructurePlacementType<?> type();
- private static boolean probabilityReducer(long levelSeed, int regionX, int regionZ, int salt, float probability) {
+ private static boolean probabilityReducer(long levelSeed, int regionX, int regionZ, int salt, float probability, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - Add missing structure set seed configs; ignore here
WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L));
worldgenRandom.setLargeFeatureWithSalt(levelSeed, regionX, regionZ, salt);
return worldgenRandom.nextFloat() < probability;
}
- private static boolean legacyProbabilityReducerWithDouble(long baseSeed, int salt, int chunkX, int chunkZ, float probability) {
+ private static boolean legacyProbabilityReducerWithDouble(long baseSeed, int salt, int chunkX, int chunkZ, float probability, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - Add missing structure set seed configs
WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L));
+ if (saltOverride == null) { // Paper - Add missing structure set seed configs
worldgenRandom.setLargeFeatureSeed(baseSeed, chunkX, chunkZ);
+ // Paper start - Add missing structure set seed configs
+ } else {
+ worldgenRandom.setLargeFeatureWithSalt(baseSeed, chunkX, chunkZ, saltOverride);
+ }
+ // Paper end - Add missing structure set seed configs
return worldgenRandom.nextDouble() < probability;
}
- private static boolean legacyArbitrarySaltProbabilityReducer(long levelSeed, int salt, int regionX, int regionZ, float probability) {
+ private static boolean legacyArbitrarySaltProbabilityReducer(long levelSeed, int salt, int regionX, int regionZ, float probability, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - Add missing structure set seed configs
WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L));
- worldgenRandom.setLargeFeatureWithSalt(levelSeed, regionX, regionZ, 10387320);
+ worldgenRandom.setLargeFeatureWithSalt(levelSeed, regionX, regionZ, saltOverride != null ? saltOverride : HIGHLY_ARBITRARY_RANDOM_SALT); // Paper - Add missing structure set seed configs
return worldgenRandom.nextFloat() < probability;
}
- private static boolean legacyPillagerOutpostReducer(long levelSeed, int salt, int regionX, int regionZ, float probability) {
+ private static boolean legacyPillagerOutpostReducer(long levelSeed, int salt, int regionX, int regionZ, float probability, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - Add missing structure set seed configs; ignore here
int i = regionX >> 4;
int i1 = regionZ >> 4;
WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L));
@@ -147,7 +_,7 @@
@FunctionalInterface
public interface FrequencyReducer {
- boolean shouldGenerate(long levelSeed, int i, int salt, int regionX, float regionZ);
+ boolean shouldGenerate(long levelSeed, int i, int salt, int regionX, float regionZ, @org.jetbrains.annotations.Nullable Integer saltOverride); // Paper - Add missing structure set seed configs
}
public static enum FrequencyReductionMethod implements StringRepresentable {
@@ -167,8 +_,8 @@
this.reducer = reducer;
}
- public boolean shouldGenerate(long levelSeed, int salt, int regionX, int regionZ, float probability) {
- return this.reducer.shouldGenerate(levelSeed, salt, regionX, regionZ, probability);
+ public boolean shouldGenerate(long levelSeed, int salt, int regionX, int regionZ, float probability, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - Add missing structure set seed configs
+ return this.reducer.shouldGenerate(levelSeed, salt, regionX, regionZ, probability, saltOverride); // Paper - Add missing structure set seed configs
}
@Override