mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
103 lines
5.1 KiB
Diff
103 lines
5.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Sat, 18 Jul 2020 11:27:43 -0500
|
|
Subject: [PATCH] Populator seed controls
|
|
|
|
|
|
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
|
|
index dae2e5d707..55b67f1057 100644
|
|
--- a/src/main/java/co/aikar/timings/TimingsExport.java
|
|
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
|
|
@@ -293,7 +293,7 @@ public class TimingsExport extends Thread {
|
|
JSONObject object = new JSONObject();
|
|
for (String key : config.getKeys(false)) {
|
|
String fullKey = (parentKey != null ? parentKey + "." + key : key);
|
|
- if (fullKey.equals("database") || fullKey.equals("settings.bungeecord-addresses") || TimingsManager.hiddenConfigs.contains(fullKey) || key.startsWith("seed-") || key.equals("worldeditregentempworld")) {
|
|
+ if (fullKey.equals("database") || fullKey.equals("settings.bungeecord-addresses") || TimingsManager.hiddenConfigs.contains(fullKey) || key.startsWith("seed-") || key.equals("worldeditregentempworld") || fullKey.contains("worldgen.seeds.populator")) { // Tuinity
|
|
continue;
|
|
}
|
|
final Object val = config.get(key);
|
|
diff --git a/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java b/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java
|
|
index 1c7b858ed5..338ecd2d75 100644
|
|
--- a/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java
|
|
+++ b/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java
|
|
@@ -1,5 +1,6 @@
|
|
package com.tuinity.tuinity.config;
|
|
|
|
+import co.aikar.timings.TimingsManager;
|
|
import com.destroystokyo.paper.util.SneakyThrow;
|
|
import net.minecraft.server.TicketType;
|
|
import org.bukkit.Bukkit;
|
|
@@ -249,6 +250,11 @@ public final class TuinityConfig {
|
|
return this.config.getDouble(path, this.worldDefaults.getDouble(path));
|
|
}
|
|
|
|
+ String getString(final String path, final String dfl) {
|
|
+ this.worldDefaults.addDefault(path, dfl);
|
|
+ return this.config.getString(path, this.worldDefaults.getString(path));
|
|
+ }
|
|
+
|
|
/** ignored if {@link TuinityConfig#tickWorldsInParallel} == false */
|
|
public int threads;
|
|
|
|
@@ -274,6 +280,19 @@ public final class TuinityConfig {
|
|
this.spawnLimitAmbient = this.getInt(path + ".ambient", -1);
|
|
}
|
|
|
|
+ public Long populatorSeed;
|
|
+ public boolean useRandomPopulatorSeed;
|
|
+
|
|
+ private void populatorSeed() {
|
|
+ final String seedString = this.getString("worldgen.seeds.populator", "default");
|
|
+ if (seedString.equalsIgnoreCase("random")) {
|
|
+ this.useRandomPopulatorSeed = true;
|
|
+ } else if (!seedString.equalsIgnoreCase("default")) {
|
|
+ this.populatorSeed = Long.parseLong(seedString);
|
|
+ }
|
|
+ if (!TimingsManager.hiddenConfigs.contains("worldgen.seeds.populator")) TimingsManager.hiddenConfigs.add("worldgen.seeds.populator");
|
|
+ }
|
|
+
|
|
}
|
|
|
|
}
|
|
\ No newline at end of file
|
|
diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java
|
|
index 9259ba1af5..37359b1cd2 100644
|
|
--- a/src/main/java/net/minecraft/server/BiomeBase.java
|
|
+++ b/src/main/java/net/minecraft/server/BiomeBase.java
|
|
@@ -350,6 +350,10 @@ public class BiomeBase {
|
|
return (List) this.r.get(worldgenstage_decoration);
|
|
}
|
|
|
|
+ // Tuinity start - populator seed control
|
|
+ private static final java.security.SecureRandom SECURE_RANDOM = new java.security.SecureRandom();
|
|
+ // Tuinity end - populator seed control
|
|
+
|
|
public void a(WorldGenStage.Decoration worldgenstage_decoration, StructureManager structuremanager, ChunkGenerator chunkgenerator, GeneratorAccessSeed generatoraccessseed, long i, SeededRandom seededrandom, BlockPosition blockposition) {
|
|
int j = 0;
|
|
Iterator iterator;
|
|
@@ -387,10 +391,22 @@ public class BiomeBase {
|
|
}
|
|
}
|
|
|
|
+ // Tuinity start - populator seed control
|
|
+ long populatorSeed;
|
|
+ WorldServer world = (WorldServer)((ChunkProviderServer)generatoraccessseed.getChunkProvider()).getWorld();
|
|
+ if (world.tuinityConfig.useRandomPopulatorSeed) {
|
|
+ populatorSeed = SECURE_RANDOM.nextLong();
|
|
+ } else if (world.tuinityConfig.populatorSeed != null) {
|
|
+ populatorSeed = world.tuinityConfig.populatorSeed.longValue();
|
|
+ } else {
|
|
+ populatorSeed = i;
|
|
+ }
|
|
+ // Tuinity end - populator seed control
|
|
+
|
|
for (iterator = ((List) this.r.get(worldgenstage_decoration)).iterator(); iterator.hasNext(); ++j) {
|
|
WorldGenFeatureConfigured<?, ?> worldgenfeatureconfigured = (WorldGenFeatureConfigured) iterator.next();
|
|
|
|
- seededrandom.b(i, j, worldgenstage_decoration.ordinal());
|
|
+ seededrandom.b(populatorSeed, j, worldgenstage_decoration.ordinal()); // Tuinity - populator seed control - move i up into default branch
|
|
|
|
try {
|
|
worldgenfeatureconfigured.a(generatoraccessseed, structuremanager, chunkgenerator, seededrandom, blockposition);
|