mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
93 lines
5.0 KiB
Diff
93 lines
5.0 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 dae2e5d70756c5b61163d57099b65f7e415b288c..55b67f1057224101272f9d6023a93872c4423405 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 42ce3b80217b574a1852e12f500b366a912e23e2..03e4d9d8bd29587492afbaab9400f3ae1e5e6dea 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.MinecraftServer;
|
|
import net.minecraft.server.TicketType;
|
|
@@ -376,6 +377,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 0854ac9ef586b378420d9899f3afd2755e6f9f33..df6874c1cf5fc5764dc575866aab87883b6cf035 100644
|
|
--- a/src/main/java/net/minecraft/server/BiomeBase.java
|
|
+++ b/src/main/java/net/minecraft/server/BiomeBase.java
|
|
@@ -189,6 +189,10 @@ public final class BiomeBase {
|
|
return this.k;
|
|
}
|
|
|
|
+ // 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(StructureManager structuremanager, ChunkGenerator chunkgenerator, RegionLimitedWorldAccess regionlimitedworldaccess, long i, SeededRandom seededrandom, BlockPosition blockposition) {
|
|
List<List<Supplier<WorldGenFeatureConfigured<?, ?>>>> list = this.k.c();
|
|
int j = WorldGenStage.Decoration.values().length;
|
|
@@ -225,12 +229,24 @@ public final class BiomeBase {
|
|
}
|
|
}
|
|
|
|
+ // Tuinity start - populator seed control
|
|
+ long populatorSeed;
|
|
+ WorldServer world = (WorldServer)((ChunkProviderServer)regionlimitedworldaccess.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
|
|
+
|
|
if (list.size() > k) {
|
|
for (Iterator iterator1 = ((List) list.get(k)).iterator(); iterator1.hasNext(); ++l) {
|
|
Supplier<WorldGenFeatureConfigured<?, ?>> supplier = (Supplier) iterator1.next();
|
|
WorldGenFeatureConfigured<?, ?> worldgenfeatureconfigured = (WorldGenFeatureConfigured) supplier.get();
|
|
|
|
- seededrandom.b(i, l, k);
|
|
+ seededrandom.b(populatorSeed, l, k); // Tuinity - populator seed control - move i up into default branch
|
|
|
|
try {
|
|
worldgenfeatureconfigured.a(regionlimitedworldaccess, chunkgenerator, seededrandom, blockposition);
|