mirror of
https://hub.spigotmc.org/stash/scm/spigot/spigot.git
synced 2025-09-18 21:33:01 +00:00
69 lines
3.2 KiB
Diff
69 lines
3.2 KiB
Diff
From 5845086ddc640e474fc5d4102eefe72df1ade91b 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 b5eb33275..1e3c7fc4b 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
|
|
@@ -92,12 +92,27 @@ 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 = ChunkStatus.FULL.getName().equals(nbttagcompound.getCompound("Level").getString("Status"));
|
|
+ }
|
|
+ // Spigot end
|
|
+
|
|
injectDatafixingContext(nbttagcompound, resourcekey, optional);
|
|
nbttagcompound = GameProfileSerializer.update(this.fixerUpper, DataFixTypes.CHUNK, nbttagcompound, Math.max(1493, i));
|
|
if (i < SharedConstants.getCurrentVersion().getWorldVersion()) {
|
|
nbttagcompound.putInt("DataVersion", SharedConstants.getCurrentVersion().getWorldVersion());
|
|
}
|
|
|
|
+ // Spigot start
|
|
+ if (stopBelowZero) {
|
|
+ nbttagcompound.putString("Status", ChunkStatus.HEIGHTMAPS.getName());
|
|
+ }
|
|
+ // Spigot end
|
|
+
|
|
nbttagcompound.remove("__context");
|
|
return nbttagcompound;
|
|
}
|
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
index c47a8b670..aab9684a7 100644
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
@@ -398,4 +398,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 2d2d5d622..eb5369c37 100644
|
|
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
@@ -380,4 +380,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.25.1
|
|
|