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 c95c961b12c3ba7f1adbe19809856f16e7cf3b05 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 4510f4acc7..677da7678b 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
|
|
@@ -101,12 +101,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 = "full".equals(nbttagcompound.getCompound("Level").getString("Status"));
|
|
+ }
|
|
+ // Spigot end
|
|
+
|
|
injectDatafixingContext(nbttagcompound, resourcekey, optional);
|
|
nbttagcompound = DataFixTypes.CHUNK.updateToCurrentVersion(this.fixerUpper, nbttagcompound, Math.max(1493, i));
|
|
if (i < SharedConstants.getCurrentVersion().getDataVersion().getVersion()) {
|
|
GameProfileSerializer.addCurrentDataVersion(nbttagcompound);
|
|
}
|
|
|
|
+ // Spigot start
|
|
+ if (stopBelowZero) {
|
|
+ nbttagcompound.putString("Status", net.minecraft.core.registries.BuiltInRegistries.CHUNK_STATUS.getKey(ChunkStatus.SPAWN).toString());
|
|
+ }
|
|
+ // 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 a5c61d0032..50b6f0219a 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 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.43.0
|
|
|