aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0031-Generator-Settings.patch
blob: b4cff3740a5d4bdc20cc7b1b857fd553a991c27b (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
From 886b8af6b9e07e9214c61bf0ba100e8d4c5a0ac3 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 c00fa83d5..3b19b53a8 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -155,4 +155,28 @@ public class PaperWorldConfig {
         disableEndCredits = getBoolean("game-mechanics.disable-end-credits", false);
         log("End credits disabled: " + disableEndCredits);
     }
+
+    public boolean generateCanyon;
+    public boolean generateCaves;
+    public boolean generateDungeon;
+    public boolean generateFortress;
+    public boolean generateMineshaft;
+    public boolean generateMonument;
+    public boolean generateStronghold;
+    public boolean generateTemple;
+    public boolean generateVillage;
+    public boolean generateFlatBedrock;
+
+    private void generatorSettings() {
+        generateCanyon = getBoolean("generator-settings.canyon", true);
+        generateCaves = getBoolean("generator-settings.caves", true);
+        generateDungeon = getBoolean("generator-settings.dungeon", true);
+        generateFortress = getBoolean("generator-settings.fortress", true);
+        generateMineshaft = getBoolean("generator-settings.mineshaft", true);
+        generateMonument = getBoolean("generator-settings.monument", true);
+        generateStronghold = getBoolean("generator-settings.stronghold", true);
+        generateTemple = getBoolean("generator-settings.temple", true);
+        generateVillage = getBoolean("generator-settings.village", true);
+        generateFlatBedrock = getBoolean("generator-settings.flat-bedrock", false);
+    }
 }
diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java
index 62a338e95..d3f1dceb6 100644
--- a/src/main/java/net/minecraft/server/BiomeBase.java
+++ b/src/main/java/net/minecraft/server/BiomeBase.java
@@ -179,7 +179,7 @@ public abstract class BiomeBase {
         BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
 
         for (int l1 = 255; l1 >= 0; --l1) {
-            if (l1 <= random.nextInt(5)) {
+            if (l1 <= (world.paperConfig.generateFlatBedrock ? 0 : random.nextInt(5))) { // Paper - Configurable flat bedrock
                 chunksnapshot.a(k1, l1, j1, BiomeBase.c);
             } else {
                 IBlockData iblockdata2 = chunksnapshot.a(k1, l1, j1);
diff --git a/src/main/java/net/minecraft/server/BiomeMesa.java b/src/main/java/net/minecraft/server/BiomeMesa.java
index 3d0a60b93..121419302 100644
--- a/src/main/java/net/minecraft/server/BiomeMesa.java
+++ b/src/main/java/net/minecraft/server/BiomeMesa.java
@@ -99,7 +99,7 @@ public class BiomeMesa extends BiomeBase {
                 chunksnapshot.a(l, i2, k, BiomeMesa.a);
             }
 
-            if (i2 <= random.nextInt(5)) {
+            if (i2 <= (world.paperConfig.generateFlatBedrock ? 0 : random.nextInt(5))) { // Paper - Configurable flat bedrock
                 chunksnapshot.a(l, i2, k, BiomeMesa.c);
             } else if (l1 < 15 || this.J) {
                 IBlockData iblockdata2 = chunksnapshot.a(l, i2, k);
diff --git a/src/main/java/net/minecraft/server/ChunkProviderFlat.java b/src/main/java/net/minecraft/server/ChunkProviderFlat.java
index d958a6654..f8a9f499f 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderFlat.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderFlat.java
@@ -26,7 +26,7 @@ public class ChunkProviderFlat implements ChunkGenerator {
         if (flag) {
             Map map = this.d.b();
 
-            if (map.containsKey("village")) {
+            if (map.containsKey("village") && world.paperConfig.generateVillage) { // Paper
                 Map map1 = (Map) map.get("village");
 
                 if (!map1.containsKey("size")) {
@@ -36,19 +36,19 @@ public class ChunkProviderFlat implements ChunkGenerator {
                 this.e.put("Village", new WorldGenVillage(map1));
             }
 
-            if (map.containsKey("biome_1")) {
+            if (map.containsKey("biome_1") && world.paperConfig.generateTemple) { // Paper
                 this.e.put("Temple", new WorldGenLargeFeature((Map) map.get("biome_1")));
             }
 
-            if (map.containsKey("mineshaft")) {
+            if (map.containsKey("mineshaft") && world.paperConfig.generateMineshaft) { // Paper
                 this.e.put("Mineshaft", new WorldGenMineshaft((Map) map.get("mineshaft")));
             }
 
-            if (map.containsKey("stronghold")) {
+            if (map.containsKey("stronghold") && world.paperConfig.generateStronghold) { // Paper
                 this.e.put("Stronghold", new WorldGenStronghold((Map) map.get("stronghold")));
             }
 
-            if (map.containsKey("oceanmonument")) {
+            if (map.containsKey("oceanmonument") && world.paperConfig.generateMonument) { // Paper
                 this.e.put("Monument", new WorldGenMonument((Map) map.get("oceanmonument")));
             }
         }
@@ -61,7 +61,7 @@ public class ChunkProviderFlat implements ChunkGenerator {
             this.i = new WorldGenLakes(Blocks.LAVA);
         }
 
-        this.g = this.d.b().containsKey("dungeon");
+        this.g = world.paperConfig.generateDungeon && this.d.b().containsKey("dungeon");  // Paper
         int j = 0;
         int k = 0;
         boolean flag1 = true;
diff --git a/src/main/java/net/minecraft/server/ChunkProviderGenerate.java b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java
index 7ba6b9add..776ebd653 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderGenerate.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java
@@ -160,32 +160,32 @@ public class ChunkProviderGenerate implements ChunkGenerator {
         this.a(i, j, chunksnapshot);
         this.D = this.n.getWorldChunkManager().getBiomeBlock(this.D, i * 16, j * 16, 16, 16);
         this.a(i, j, chunksnapshot, this.D);
-        if (this.s.r) {
+        if (this.s.r && this.n.paperConfig.generateCaves) { // Paper
             this.v.a(this.n, i, j, chunksnapshot);
         }
 
-        if (this.s.A) {
+        if (this.s.A && this.n.paperConfig.generateCanyon) { // Paper
             this.A.a(this.n, i, j, chunksnapshot);
         }
 
         if (this.o) {
-            if (this.s.w) {
+            if (this.s.w && this.n.paperConfig.generateMineshaft) { // Paper
                 this.y.a(this.n, i, j, chunksnapshot);
             }
 
-            if (this.s.v) {
+            if (this.s.v&& this.n.paperConfig.generateVillage) { // Paper
                 this.x.a(this.n, i, j, chunksnapshot);
             }
 
-            if (this.s.u) {
+            if (this.s.u && this.n.paperConfig.generateStronghold) { // Paper
                 this.w.a(this.n, i, j, chunksnapshot);
             }
 
-            if (this.s.x) {
+            if (this.s.x && this.n.paperConfig.generateTemple) { // Paper
                 this.z.a(this.n, i, j, chunksnapshot);
             }
 
-            if (this.s.y) {
+            if (this.s.y && this.n.paperConfig.generateMonument) { // Paper
                 this.B.a(this.n, i, j, chunksnapshot);
             }
 
@@ -329,23 +329,23 @@ public class ChunkProviderGenerate implements ChunkGenerator {
         ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
 
         if (this.o) {
-            if (this.s.w) {
+            if (this.s.w && this.n.paperConfig.generateMineshaft) { // Paper
                 this.y.a(this.n, this.i, chunkcoordintpair);
             }
 
-            if (this.s.v) {
+            if (this.s.v && this.n.paperConfig.generateVillage) { // Paper
                 flag = this.x.a(this.n, this.i, chunkcoordintpair);
             }
 
-            if (this.s.u) {
+            if (this.s.u && this.n.paperConfig.generateStronghold) { // Paper
                 this.w.a(this.n, this.i, chunkcoordintpair);
             }
 
-            if (this.s.x) {
+            if (this.s.x && this.n.paperConfig.generateTemple) { // Paper
                 this.z.a(this.n, this.i, chunkcoordintpair);
             }
 
-            if (this.s.y) {
+            if (this.s.y && this.n.paperConfig.generateMonument) { // Paper
                 this.B.a(this.n, this.i, chunkcoordintpair);
             }
 
@@ -374,7 +374,7 @@ public class ChunkProviderGenerate implements ChunkGenerator {
             }
         }
 
-        if (this.s.s) {
+        if (this.s.s && this.n.paperConfig.generateDungeon) { // Paper
             for (k1 = 0; k1 < this.s.t; ++k1) {
                 l1 = this.i.nextInt(16) + 8;
                 i2 = this.i.nextInt(256);
@@ -439,23 +439,23 @@ public class ChunkProviderGenerate implements ChunkGenerator {
 
     public void recreateStructures(Chunk chunk, int i, int j) {
         if (this.o) {
-            if (this.s.w) {
+            if (this.s.w && this.n.paperConfig.generateMineshaft) { // Paper
                 this.y.a(this.n, i, j, (ChunkSnapshot) null);
             }
 
-            if (this.s.v) {
+            if (this.s.v && this.n.paperConfig.generateVillage) { // Paper
                 this.x.a(this.n, i, j, (ChunkSnapshot) null);
             }
 
-            if (this.s.u) {
+            if (this.s.u && this.n.paperConfig.generateStronghold) { // Paper
                 this.w.a(this.n, i, j, (ChunkSnapshot) null);
             }
 
-            if (this.s.x) {
+            if (this.s.x && this.n.paperConfig.generateTemple) { // Paper
                 this.z.a(this.n, i, j, (ChunkSnapshot) null);
             }
 
-            if (this.s.y) {
+            if (this.s.y && this.n.paperConfig.generateMonument) { // Paper
                 this.B.a(this.n, i, j, (ChunkSnapshot) null);
             }
 
diff --git a/src/main/java/net/minecraft/server/ChunkProviderHell.java b/src/main/java/net/minecraft/server/ChunkProviderHell.java
index f9519d7e1..ca64ae067 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderHell.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderHell.java
@@ -151,7 +151,10 @@ public class ChunkProviderHell implements ChunkGenerator {
                 IBlockData iblockdata1 = ChunkProviderHell.b;
 
                 for (int l1 = 127; l1 >= 0; --l1) {
-                    if (l1 < 127 - this.p.nextInt(5) && l1 > this.p.nextInt(5)) {
+                    // Paper start - Configurable flat bedrock worldgen
+                    if (l1 < 127 - (n.paperConfig.generateFlatBedrock ? 0 : this.p.nextInt(5)) &&
+                            l1 > (n.paperConfig.generateFlatBedrock ? 0 : this.p.nextInt(5))) {
+                        // Paper end
                         IBlockData iblockdata2 = chunksnapshot.a(i1, l1, l);
 
                         if (iblockdata2.getBlock() != null && iblockdata2.getMaterial() != Material.AIR) {
@@ -380,6 +383,6 @@ public class ChunkProviderHell implements ChunkGenerator {
     }
 
     public void recreateStructures(Chunk chunk, int i, int j) {
-        this.I.a(this.n, i, j, (ChunkSnapshot) null);
+        if (this.n.paperConfig.generateFortress) this.I.a(this.n, i, j, (ChunkSnapshot) null);
     }
 }
diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java
index fb350c408..9c1605b14 100644
--- a/src/main/java/net/minecraft/server/StructureGenerator.java
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
@@ -96,6 +96,7 @@ public abstract class StructureGenerator extends WorldGenBase {
     }
 
     public boolean b(BlockPosition blockposition) {
+        if (this.g == null) return false; // Paper
         this.a(this.g);
         return this.c(blockposition) != null;
     }
@@ -124,6 +125,7 @@ public abstract class StructureGenerator extends WorldGenBase {
     }
 
     public boolean a(World world, BlockPosition blockposition) {
+        if (this.g == null) return false; // Paper
         this.a(world);
         ObjectIterator objectiterator = this.c.values().iterator();
 
-- 
2.12.2