mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 09:57:43 +01:00
Fix for SPIGOT-6278 is no longer needed (#792)
This commit is contained in:
75
patches/server/0204-Structure-seed-options.patch
Normal file
75
patches/server/0204-Structure-seed-options.patch
Normal file
@@ -0,0 +1,75 @@
|
||||
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/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
index e4591c0b3c8547cc6f4e2a0891fc378ee4334d9e..b2c93ce627cf0a50b4b0a60d2d4206e6c6904e0a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
@@ -87,7 +87,10 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource {
|
||||
this.biomeSource = populationSource;
|
||||
this.runtimeBiomeSource = biomeSource;
|
||||
this.settings = structuresConfig;
|
||||
- this.strongholdSeed = worldSeed;
|
||||
+ // Purpur start
|
||||
+ int salt = org.purpurmc.purpur.PurpurConfig.seedStructureStronghold;
|
||||
+ this.strongholdSeed = worldSeed + (salt != -1 ? salt : 0);
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
private void generateStrongholds() {
|
||||
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 64a8dad26d17a9f921d4fd57991dab955e08afb5..ad8d92f04524fa6e7a7a4c390e8b744889dae968 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -194,6 +194,17 @@ public class PurpurConfig {
|
||||
deathMessageOnlyBroadcastToAffectedPlayer = getBoolean("settings.broadcasts.death.only-broadcast-to-affected-player", deathMessageOnlyBroadcastToAffectedPlayer);
|
||||
}
|
||||
|
||||
+ public static int seedStructureBuriedTreasure = -1;
|
||||
+ public static int seedStructureMineshaft = -1;
|
||||
+ public static int seedStructureStronghold = -1;
|
||||
+ private static void seedSettings() {
|
||||
+ seedStructureBuriedTreasure = getInt("settings.seed.structure.buried_treasure", seedStructureBuriedTreasure);
|
||||
+ seedStructureMineshaft = getInt("settings.seed.structure.mineshaft", seedStructureMineshaft);
|
||||
+ seedStructureStronghold = getInt("settings.seed.structure.stronghold", seedStructureStronghold);
|
||||
+ // 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);
|
||||
Reference in New Issue
Block a user