aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0416-Generator-Settings.patch
blob: 101c116ea26e9f76804abbbc05a005a7551e1dd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
From cb364d0e7fd693372db414ea9de36c7081dfe2f8 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Wed, 2 Mar 2016 02:17:54 -0600
Subject: [PATCH] Generator Settings


diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 09c8ea2ed..7723b1c15 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -625,4 +625,9 @@ public class PaperWorldConfig {
     private void perPlayerMobSpawns() {
         perPlayerMobSpawns = getBoolean("per-player-mob-spawns", false);
     }
+
+    public boolean generateFlatBedrock;
+    private void generatorSettings() {
+        generateFlatBedrock = getBoolean("generator-settings.flat-bedrock", false);
+    }
 }
diff --git a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java
index 096866b2b..338b67c3c 100644
--- a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java
+++ b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java
@@ -198,8 +198,8 @@ public abstract class ChunkGeneratorAbstract<T extends GeneratorSettingsDefault>
         int i = ichunkaccess.getPos().d();
         int j = ichunkaccess.getPos().e();
         T t0 = this.getSettings();
-        int k = t0.u();
-        int l = t0.t();
+        int k = t0.u(); final int floorHeight = k; // Paper
+        int l = t0.t(); final int roofHeight = l; // Paper
         Iterator iterator = BlockPosition.b(i, 0, j, i + 15, 0, j + 15).iterator();
 
         while (iterator.hasNext()) {
@@ -208,7 +208,7 @@ public abstract class ChunkGeneratorAbstract<T extends GeneratorSettingsDefault>
 
             if (l > 0) {
                 for (i1 = l; i1 >= l - 4; --i1) {
-                    if (i1 >= l - random.nextInt(5)) {
+                    if (i1 >= (getWorld().paperConfig.generateFlatBedrock ? roofHeight : l - random.nextInt(5))) { // Paper - Configurable flat bedrock roof
                         ichunkaccess.setType(blockposition_mutableblockposition.d(blockposition.getX(), i1, blockposition.getZ()), Blocks.BEDROCK.getBlockData(), false);
                     }
                 }
@@ -216,7 +216,7 @@ public abstract class ChunkGeneratorAbstract<T extends GeneratorSettingsDefault>
 
             if (k < 256) {
                 for (i1 = k + 4; i1 >= k; --i1) {
-                    if (i1 <= k + random.nextInt(5)) {
+                    if (i1 <= (getWorld().paperConfig.generateFlatBedrock ? floorHeight : k + random.nextInt(5))) { // Paper - Configurable flat bedrock floor
                         ichunkaccess.setType(blockposition_mutableblockposition.d(blockposition.getX(), i1, blockposition.getZ()), Blocks.BEDROCK.getBlockData(), false);
                     }
                 }
-- 
2.23.0