mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: 12dec20 Bump paerweight to 1.1.7 e33ed89 Get short commit ref using a more proper method 7d6147d Remove now unneeded patch due to paperweight 1.1.7 e72fa41 Update task dependency for includeMappings so the new task isn't skipped 0ad5526 Trim whitspace off of git hash (oops) Tuinity Changes: e878ba9 Update paper 2bd2849 Bring back fix codec spam patch
66 lines
3.8 KiB
Diff
66 lines
3.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Fri, 25 Jun 2021 18:23:36 -0400
|
|
Subject: [PATCH] Populator seed controls
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java
|
|
index a7a7e6cd87270e64a92448f03f8b0b0c7e375ec7..9fb19162c0e436122087d03d37b502a19b31cb9e 100644
|
|
--- a/src/main/java/net/minecraft/world/level/biome/Biome.java
|
|
+++ b/src/main/java/net/minecraft/world/level/biome/Biome.java
|
|
@@ -219,6 +219,7 @@ public final class Biome {
|
|
return this.generationSettings;
|
|
}
|
|
|
|
+ private static final java.security.SecureRandom SECURE_RANDOM = new java.security.SecureRandom(); // Purpur
|
|
public void generate(StructureFeatureManager structureAccessor, ChunkGenerator chunkGenerator, WorldGenRegion region, long populationSeed, WorldgenRandom random, BlockPos origin) {
|
|
List<List<Supplier<ConfiguredFeature<?, ?>>>> list = this.generationSettings.features();
|
|
Registry<ConfiguredFeature<?, ?>> registry = region.registryAccess().registryOrThrow(Registry.CONFIGURED_FEATURE_REGISTRY);
|
|
@@ -257,13 +258,20 @@ public final class Biome {
|
|
}
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ long populatorSeed = populationSeed;
|
|
+ if (((net.minecraft.server.level.ServerChunkCache) region.getChunkSource()).getLevel().purpurConfig.randomPopulatorSeed) {
|
|
+ populatorSeed = SECURE_RANDOM.nextLong();
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
if (list.size() > j) {
|
|
for(Supplier<ConfiguredFeature<?, ?>> supplier2 : list.get(j)) {
|
|
ConfiguredFeature<?, ?> configuredFeature = supplier2.get();
|
|
Supplier<String> supplier3 = () -> {
|
|
return registry.getResourceKey(configuredFeature).map(Object::toString).orElseGet(configuredFeature::toString);
|
|
};
|
|
- random.setFeatureSeed(populationSeed, k, j);
|
|
+ random.setFeatureSeed(populatorSeed, k, j); // Purpur
|
|
|
|
try {
|
|
region.setCurrentlyGenerating(supplier3);
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 6629addad421042fae15d1b70c0a8d51ecf5f3e2..9c766351673b66f02db3b88ef7b1651e63779307 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -2242,4 +2242,20 @@ public class PurpurWorldConfig {
|
|
zombifiedPiglinJockeyTryExistingChickens = getBoolean("mobs.zombified_piglin.jockey.try-existing-chickens", zombifiedPiglinJockeyTryExistingChickens);
|
|
zombifiedPiglinCountAsPlayerKillWhenAngry = getBoolean("mobs.zombified_piglin.count-as-player-kill-when-angry", zombifiedPiglinCountAsPlayerKillWhenAngry);
|
|
}
|
|
+
|
|
+ public boolean randomPopulatorSeed = false;
|
|
+ private void seedSettings() {
|
|
+ randomPopulatorSeed = getBoolean("seed.random-populator-seed", randomPopulatorSeed);
|
|
+ if (!randomPopulatorSeed) {
|
|
+ ConfigurationSection defaultTuinity = TuinityConfig.config.getConfigurationSection("world-settings.default");
|
|
+ ConfigurationSection currentTuinity = TuinityConfig.config.getConfigurationSection(level.tuinityConfig.configPath);
|
|
+ if (currentTuinity.getString("worldgen.seeds.populator", defaultTuinity.getString("worldgen.seeds.populator", "default")).equalsIgnoreCase("random")) {
|
|
+ randomPopulatorSeed = true;
|
|
+ }
|
|
+ defaultTuinity.set("worldgen.seeds.populator", null);
|
|
+ currentTuinity.set("worldgen.seeds.populator", null);
|
|
+ }
|
|
+
|
|
+ set("seed.random-populator-seed", randomPopulatorSeed);
|
|
+ }
|
|
}
|