Skip to content

Commit f6c7d53

Browse files
Add configurable stronghold seed (#7334)
1 parent a058ac0 commit f6c7d53

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

build-data/paper.at

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,3 +298,6 @@ public net.minecraft.world.entity.player.Player checkRidingStatistics(DDD)V
298298

299299
# Fix NotePlayEvent
300300
public org.bukkit.craftbukkit.block.data.CraftBlockData toNMS(Ljava/lang/Enum;Ljava/lang/Class;)Ljava/lang/Enum;
301+
302+
# Stronghold seed configuration
303+
public-f net.minecraft.world.level.chunk.ChunkGenerator strongholdSeed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Jake Potrebic <jake.m.potrebic@gmail.com>
3+
Date: Thu, 13 Jan 2022 23:05:53 -0800
4+
Subject: [PATCH] Add config for stronghold seed
5+
6+
7+
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
8+
index 3f0d83a90e1319baa0622b708b3ba940d3cee64a..0009af6e9c6a48a63736ada2653665f74ac396ca 100644
9+
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
10+
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
11+
@@ -197,6 +197,7 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource {
12+
skipExistingChunks = event.shouldFindUnexplored();
13+
structureFeature = StructureFeature.STRUCTURES_REGISTRY.get(event.getType().getName());
14+
// Paper end
15+
+ this.updateStructureSettings(world, this.settings); // Spigot // Paper - move up to include strongholds
16+
if (structureFeature == StructureFeature.STRONGHOLD) {
17+
this.generateStrongholds();
18+
BlockPos blockposition1 = null;
19+
@@ -221,7 +222,6 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource {
20+
21+
return blockposition1;
22+
} else {
23+
- this.updateStructureSettings(world, this.settings); // Spigot
24+
StructureFeatureConfiguration structuresettingsfeature = this.settings.getConfig(structureFeature);
25+
ImmutableMultimap<ConfiguredStructureFeature<?, ?>, ResourceKey<Biome>> immutablemultimap = this.settings.structures(structureFeature);
26+
27+
@@ -528,6 +528,7 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource {
28+
java.util.Map<StructureFeature<?>, StructureFeatureConfiguration> original = settings.structureConfig();
29+
java.util.Map<StructureFeature<?>, StructureFeatureConfiguration> updated = new java.util.HashMap<>();
30+
org.spigotmc.SpigotWorldConfig conf = world.spigotConfig;
31+
+ this.strongholdSeed = Objects.requireNonNullElse(conf.strongholdSeed, this.strongholdSeed); // Paper
32+
33+
for (java.util.Map.Entry<StructureFeature<?>, StructureFeatureConfiguration> entry : original.entrySet()) {
34+
String name = Registry.STRUCTURE_FEATURE.getKey(entry.getKey()).getPath();
35+
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
36+
index a7a0b94ed22e6e3b9063a17d086f96140c6e95cf..463010859c604812091399e6068e5c2e2daa99ce 100644
37+
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
38+
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
39+
@@ -365,6 +365,7 @@ public class SpigotWorldConfig
40+
public int mansionSeed;
41+
public int fossilSeed;
42+
public int portalSeed;
43+
+ public Long strongholdSeed; // Paper
44+
private void initWorldGenSeeds()
45+
{
46+
this.villageSeed = this.getInt( "seed-village", 10387312 );
47+
@@ -383,6 +384,10 @@ public class SpigotWorldConfig
48+
this.mansionSeed = this.getInt( "seed-mansion", 10387319 );
49+
this.fossilSeed = this.getInt( "seed-fossil", 14357921 );
50+
this.portalSeed = this.getInt( "seed-portal", 34222645 );
51+
+ // Paper start
52+
+ final String strongholdSeedString = this.getString("seed-stronghold", "default");
53+
+ this.strongholdSeed = org.apache.commons.lang3.math.NumberUtils.isParsable(strongholdSeedString) ? Long.parseLong(strongholdSeedString) : null;
54+
+ // Paper end
55+
this.log( "Custom Map Seeds: Village: " + this.villageSeed + " Desert: " + this.desertSeed + " Igloo: " + this.iglooSeed + " Jungle: " + this.jungleSeed + " Swamp: " + this.swampSeed + " Monument: " + this.monumentSeed
56+
+ " Ocean: " + this.oceanSeed + " Shipwreck: " + this.shipwreckSeed + " End City: " + this.endCitySeed + " Slime: " + this.slimeSeed + " Bastion: " + this.bastionSeed + " Fortress: " + this.fortressSeed + " Mansion: " + this.mansionSeed + " Fossil: " + this.fossilSeed + " Portal: " + this.portalSeed );
57+
}

0 commit comments

Comments
 (0)