mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Reuse seed in dungeons
This commit is contained in:
@@ -5,15 +5,28 @@ Subject: [PATCH] Configurable dungeon seed
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldGenDecoratorDungeon.java b/src/main/java/net/minecraft/server/WorldGenDecoratorDungeon.java
|
||||
index 70d222996..73a2f2969 100644
|
||||
index 70d222996..2bebbd699 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldGenDecoratorDungeon.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldGenDecoratorDungeon.java
|
||||
@@ -14,10 +14,12 @@ public class WorldGenDecoratorDungeon extends WorldGenDecorator<WorldGenDecorato
|
||||
@@ -6,6 +6,7 @@ import java.util.stream.IntStream;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class WorldGenDecoratorDungeon extends WorldGenDecorator<WorldGenDecoratorDungeonConfiguration> {
|
||||
+ private Random random; // Purpur
|
||||
|
||||
public WorldGenDecoratorDungeon(Codec<WorldGenDecoratorDungeonConfiguration> codec) {
|
||||
super(codec);
|
||||
@@ -14,10 +15,17 @@ public class WorldGenDecoratorDungeon extends WorldGenDecorator<WorldGenDecorato
|
||||
public Stream<BlockPosition> a(GeneratorAccess generatoraccess, ChunkGenerator chunkgenerator, Random random, WorldGenDecoratorDungeonConfiguration worldgendecoratordungeonconfiguration, BlockPosition blockposition) {
|
||||
int i = worldgendecoratordungeonconfiguration.b;
|
||||
|
||||
+ int seed = net.pl3x.purpur.PurpurConfig.dungeonSeed; // Purpur
|
||||
+ final Random rand = seed == -1 ? random : new Random(seed); // Purpur
|
||||
+ // Purpur start
|
||||
+ if (this.random == null) {
|
||||
+ int seed = net.pl3x.purpur.PurpurConfig.dungeonSeed;
|
||||
+ this.random = seed == -1 ? random : new Random(seed);
|
||||
+ }
|
||||
+ final Random rand = this.random;
|
||||
+ // Purpur end
|
||||
return IntStream.range(0, i).mapToObj((j) -> {
|
||||
- int k = random.nextInt(16) + blockposition.getX();
|
||||
- int l = random.nextInt(16) + blockposition.getZ();
|
||||
@@ -25,17 +38,28 @@ index 70d222996..73a2f2969 100644
|
||||
return new BlockPosition(k, i1, l);
|
||||
});
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldGenDungeons.java b/src/main/java/net/minecraft/server/WorldGenDungeons.java
|
||||
index 3c7c93645..e13176fb0 100644
|
||||
index 3c7c93645..1f6ff7848 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldGenDungeons.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldGenDungeons.java
|
||||
@@ -16,7 +16,10 @@ public class WorldGenDungeons extends WorldGenerator<WorldGenFeatureEmptyConfigu
|
||||
@@ -11,12 +11,21 @@ public class WorldGenDungeons extends WorldGenerator<WorldGenFeatureEmptyConfigu
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final EntityTypes<?>[] ac = new EntityTypes[]{EntityTypes.SKELETON, EntityTypes.ZOMBIE, EntityTypes.ZOMBIE, EntityTypes.SPIDER};
|
||||
private static final IBlockData ad = Blocks.CAVE_AIR.getBlockData();
|
||||
+ private Random random; // Purpur
|
||||
|
||||
public WorldGenDungeons(Codec<WorldGenFeatureEmptyConfiguration> codec) {
|
||||
super(codec);
|
||||
}
|
||||
|
||||
+ public boolean generate(GeneratorAccessSeed generatoraccessseed, StructureManager structuremanager, ChunkGenerator chunkgenerator, Random random, BlockPosition blockposition, WorldGenFeatureEmptyConfiguration worldgenfeatureemptyconfiguration) { return a(generatoraccessseed, structuremanager, chunkgenerator, random, blockposition, worldgenfeatureemptyconfiguration); } // Purpur - decompile error?
|
||||
public boolean a(GeneratorAccessSeed generatoraccessseed, StructureManager structuremanager, ChunkGenerator chunkgenerator, Random random, BlockPosition blockposition, WorldGenFeatureEmptyConfiguration worldgenfeatureemptyconfiguration) {
|
||||
+ int seed = net.pl3x.purpur.PurpurConfig.dungeonSeed; // Purpur
|
||||
+ if (seed != -1) random = new Random(seed); // Purpur
|
||||
+ // 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;
|
||||
|
||||
Reference in New Issue
Block a user