mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
66 lines
4.5 KiB
Diff
66 lines
4.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Thu, 1 Jul 2021 19:25:05 -0500
|
|
Subject: [PATCH] Structure seed options
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/BuriedTreasureFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/BuriedTreasureFeature.java
|
|
index c4ec2e41314da9501dc62baa024607b2782d2c73..54341db6faf66c8e84156ee3a310fd0d6561b632 100644
|
|
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/BuriedTreasureFeature.java
|
|
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/BuriedTreasureFeature.java
|
|
@@ -21,7 +21,10 @@ public class BuriedTreasureFeature extends StructureFeature<ProbabilityFeatureCo
|
|
|
|
private static boolean checkLocation(PieceGeneratorSupplier.Context<ProbabilityFeatureConfiguration> context) {
|
|
WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L));
|
|
- worldgenRandom.setLargeFeatureWithSalt(context.seed(), context.chunkPos().x, context.chunkPos().z, 10387320);
|
|
+ // Purpur start
|
|
+ int salt = org.purpurmc.purpur.PurpurConfig.seedStructureBuriedTreasure;
|
|
+ worldgenRandom.setLargeFeatureWithSalt(context.seed(), context.chunkPos().x, context.chunkPos().z, salt != -1 ? salt : RANDOM_SALT);
|
|
+ // Purpur end
|
|
return worldgenRandom.nextFloat() < (context.config()).probability && context.validBiomeOnTop(Heightmap.Types.OCEAN_FLOOR_WG);
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/MineshaftFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/MineshaftFeature.java
|
|
index 45f11284bf65081b3b2e8da85114efbe5efd5b42..354a923350cbfc76645136858e8e96285de139a1 100644
|
|
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/MineshaftFeature.java
|
|
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/MineshaftFeature.java
|
|
@@ -27,6 +27,10 @@ public class MineshaftFeature extends StructureFeature<MineshaftConfiguration> {
|
|
|
|
private static boolean checkLocation(PieceGeneratorSupplier.Context<MineshaftConfiguration> context) {
|
|
WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L));
|
|
+ // Purpur start
|
|
+ int salt = org.purpurmc.purpur.PurpurConfig.seedStructureMineshaft;
|
|
+ if (salt != -1) worldgenRandom.setLargeFeatureWithSalt(context.seed(), context.chunkPos().x, context.chunkPos().z, salt); else
|
|
+ // Purpur end
|
|
worldgenRandom.setLargeFeatureSeed(context.seed(), context.chunkPos().x, context.chunkPos().z);
|
|
double d = (double)(context.config()).probability;
|
|
return worldgenRandom.nextDouble() >= d ? false : context.validBiome().test(context.chunkGenerator().getNoiseBiome(QuartPos.fromBlock(context.chunkPos().getMiddleBlockX()), QuartPos.fromBlock(50), QuartPos.fromBlock(context.chunkPos().getMiddleBlockZ())));
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
|
index dd15700d167ef169f6cfb838f8ce6517df17b605..f20736450acfb916c292068729021f57d5fbcae4 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
|
@@ -214,6 +214,23 @@ public class PurpurConfig {
|
|
deathMessageOnlyBroadcastToAffectedPlayer = getBoolean("settings.broadcasts.death.only-broadcast-to-affected-player", deathMessageOnlyBroadcastToAffectedPlayer);
|
|
}
|
|
|
|
+ public static int seedStructureBuriedTreasure = -1;
|
|
+ public static int seedStructureMineshaft = -1;
|
|
+ private static void seedSettings() {
|
|
+ seedStructureBuriedTreasure = getInt("settings.seed.structure.buried_treasure", seedStructureBuriedTreasure);
|
|
+ seedStructureMineshaft = getInt("settings.seed.structure.mineshaft", seedStructureMineshaft);
|
|
+ if (version < 26) {
|
|
+ int stronghold = getInt("settings.seed.structure.stronghold", -1);
|
|
+ set("settings.seed.structure.stronghold", null);
|
|
+ if (stronghold != -1) {
|
|
+ org.spigotmc.SpigotConfig.config.set("world-settings.default.seed-stronghold", stronghold);
|
|
+ org.spigotmc.SpigotConfig.save();
|
|
+ }
|
|
+ }
|
|
+ // hide these from timings report
|
|
+ if (!TimingsManager.hiddenConfigs.contains("settings.seed")) TimingsManager.hiddenConfigs.add("settings.seed");
|
|
+ }
|
|
+
|
|
public static String serverModName = "Purpur";
|
|
private static void serverModName() {
|
|
serverModName = getString("settings.server-mod-name", serverModName);
|