From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Wed, 15 Jul 2020 12:40:25 -0500
Subject: [PATCH] Configurable dungeon seed


diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenDungeons.java b/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenDungeons.java
index 4a2e3af98ef3383678445c1bdf535203097558ee..363de0352804e6a778d4e6ee34609a9491744aaf 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenDungeons.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenDungeons.java
@@ -27,12 +27,21 @@ public class WorldGenDungeons extends WorldGenerator<WorldGenFeatureEmptyConfigu
     private static final Logger LOGGER = LogManager.getLogger();
     private static final EntityTypes<?>[] ab = new EntityTypes[]{EntityTypes.SKELETON, EntityTypes.ZOMBIE, EntityTypes.ZOMBIE, EntityTypes.SPIDER};
     private static final IBlockData ac = Blocks.CAVE_AIR.getBlockData();
+    private Random random; // Purpur
 
     public WorldGenDungeons(Codec<WorldGenFeatureEmptyConfiguration> codec) {
         super(codec);
     }
 
+    public boolean generate(GeneratorAccessSeed generatoraccessseed, ChunkGenerator chunkgenerator, Random random, BlockPosition blockposition, WorldGenFeatureEmptyConfiguration worldgenfeatureemptyconfiguration) { return a(generatoraccessseed, chunkgenerator, random, blockposition, worldgenfeatureemptyconfiguration); } // Purpur - decompile error?
     public boolean a(GeneratorAccessSeed generatoraccessseed, ChunkGenerator chunkgenerator, Random random, BlockPosition blockposition, WorldGenFeatureEmptyConfiguration worldgenfeatureemptyconfiguration) {
+        // Purpur start
+        if (this.random == null) {
+            int seed = net.pl3x.purpur.PurpurConfig.dungeonSeed;
+            this.random = seed == -1 ? random : new Random(seed);
+        }
+        random = this.random;
+        // Purpur end
         boolean flag = true;
         int i = random.nextInt(2) + 2;
         int j = -i - 1;
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index e9257f76275774518bb1fefe3b78144fd93791ab..c356757bc6c3cca467c0f3839723391c9fc3347e 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -142,10 +142,13 @@ public class PurpurConfig {
         pingCommandOutput = getString("settings.messages.ping-command-output", pingCommandOutput);
     }
 
+    public static int dungeonSeed = -1;
     public static int endSpikeSeed = -1;
     private static void seedSettings() {
+        dungeonSeed = getInt("settings.seed.dungeon", dungeonSeed);
         endSpikeSeed = getInt("settings.seed.end-spike", endSpikeSeed);
         if (!TimingsManager.hiddenConfigs.contains("settings.seed")) TimingsManager.hiddenConfigs.add("settings.seed");
+        if (!TimingsManager.hiddenConfigs.contains("settings.seed.dungeon")) TimingsManager.hiddenConfigs.add("settings.seed.dungeon");
         if (!TimingsManager.hiddenConfigs.contains("settings.seed.end-spike")) TimingsManager.hiddenConfigs.add("settings.seed.end-spike");
     }
 
