mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 18:07:43 +01:00
patches
This commit is contained in:
65
patches/unapplied/0204-Structure-seed-options.patch
Normal file
65
patches/unapplied/0204-Structure-seed-options.patch
Normal file
@@ -0,0 +1,65 @@
|
||||
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 ff58437d0ccc4901c84b3df9afb245940fbffef1..e4201731cee6ffd14a00370666de8cee5d2d5872 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
|
||||
@@ -20,7 +20,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 f5a91db8035509ce42315a75205e9f0ae13ed127..4949c3bc2066e790364db631e7f801c1e83d01e9 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);
|
||||
Reference in New Issue
Block a user