mirror of
https://hub.spigotmc.org/stash/scm/spigot/spigot.git
synced 2024-11-21 20:56:14 +00:00
65 lines
3.3 KiB
Diff
65 lines
3.3 KiB
Diff
From f9d0a3ddb6c114c3e92a05a38955e770b755e2f5 Mon Sep 17 00:00:00 2001
|
|
From: DerFrZocker <derrieple@gmail.com>
|
|
Date: Sun, 28 Nov 2021 12:09:29 +1100
|
|
Subject: [PATCH] Configurable Below Zero Generation
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java
|
|
index e44a7582f0..95acf5cc8a 100644
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java
|
|
@@ -108,8 +108,22 @@ public class IChunkLoader implements AutoCloseable {
|
|
}
|
|
}
|
|
|
|
+ // Spigot start - SPIGOT-6806: Quick and dirty way to prevent below zero generation in old chunks, by setting the status to heightmap instead of empty
|
|
+ boolean stopBelowZero = false;
|
|
+ boolean belowZeroGenerationInExistingChunks = (generatoraccess != null) ? ((WorldServer) generatoraccess).spigotConfig.belowZeroGenerationInExistingChunks : org.spigotmc.SpigotConfig.belowZeroGenerationInExistingChunks;
|
|
+
|
|
+ if (i <= 2730 && !belowZeroGenerationInExistingChunks) {
|
|
+ stopBelowZero = "full".equals(nbttagcompound.getCompound("Level").getString("Status"));
|
|
+ }
|
|
+ // Spigot end
|
|
+
|
|
injectDatafixingContext(nbttagcompound, resourcekey, optional);
|
|
nbttagcompound = DataFixTypes.CHUNK.updateToCurrentVersion(this.fixerUpper, nbttagcompound, Math.max(1493, i));
|
|
+ // Spigot start
|
|
+ if (stopBelowZero) {
|
|
+ nbttagcompound.putString("Status", net.minecraft.core.registries.BuiltInRegistries.CHUNK_STATUS.getKey(ChunkStatus.SPAWN).toString());
|
|
+ }
|
|
+ // Spigot end
|
|
removeDatafixingContext(nbttagcompound);
|
|
GameProfileSerializer.addCurrentDataVersion(nbttagcompound);
|
|
return nbttagcompound;
|
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
index 5e7ec99192..1c4649f727 100644
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
@@ -401,4 +401,9 @@ public class SpigotConfig
|
|
private static void disablePlayerDataSaving() {
|
|
disablePlayerDataSaving = getBoolean("players.disable-saving", false);
|
|
}
|
|
+
|
|
+ public static boolean belowZeroGenerationInExistingChunks;
|
|
+ private static void belowZeroGenerationInExistingChunks() {
|
|
+ belowZeroGenerationInExistingChunks = getBoolean("world-settings.default.below-zero-generation-in-existing-chunks", true);
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
index b6ac09ee9f..ebddbf6d0c 100644
|
|
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
@@ -388,4 +388,9 @@ public class SpigotWorldConfig
|
|
{
|
|
thunderChance = getInt("thunder-chance", 100000);
|
|
}
|
|
+
|
|
+ public boolean belowZeroGenerationInExistingChunks;
|
|
+ private void belowZeroGenerationInExistingChunks() {
|
|
+ belowZeroGenerationInExistingChunks = getBoolean("below-zero-generation-in-existing-chunks", true);
|
|
+ }
|
|
}
|
|
--
|
|
2.47.0
|
|
|