From d3ce5089173313a357823c89c3d000244f1fc8b7 Mon Sep 17 00:00:00 2001 From: Byteflux Date: Tue, 2 Jun 2015 00:41:23 -0700 Subject: [PATCH] Generator Settings diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java index f56a035..6311107 100644 --- a/src/main/java/net/minecraft/server/BiomeBase.java +++ b/src/main/java/net/minecraft/server/BiomeBase.java @@ -279,7 +279,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.paperSpigotConfig.generateFlatBedrock ? 0 : random.nextInt(5))) { // PaperSpigot - Configurable flat bedrock chunksnapshot.a(k1, l1, j1, Blocks.BEDROCK.getBlockData()); } 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 fd827f2..65cd706 100644 --- a/src/main/java/net/minecraft/server/BiomeMesa.java +++ b/src/main/java/net/minecraft/server/BiomeMesa.java @@ -94,7 +94,7 @@ public class BiomeMesa extends BiomeBase { chunksnapshot.a(l, l1, k, Blocks.STONE.getBlockData()); } - if (l1 <= random.nextInt(5)) { + if (l1 <= (world.paperSpigotConfig.generateFlatBedrock ? 0 : random.nextInt(5))) { // PaperSpigot - Configurable flat bedrock chunksnapshot.a(l, l1, k, Blocks.BEDROCK.getBlockData()); } else { IBlockData iblockdata2 = chunksnapshot.a(l, l1, k); diff --git a/src/main/java/net/minecraft/server/ChunkProviderFlat.java b/src/main/java/net/minecraft/server/ChunkProviderFlat.java index d340fbf..717d3e8 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 IChunkProvider { if (flag) { Map map = this.d.b(); - if (map.containsKey("village")) { + if (map.containsKey("village") && world.paperSpigotConfig.generateVillage) { // PaperSpigot Map map1 = (Map) map.get("village"); if (!map1.containsKey("size")) { @@ -36,19 +36,19 @@ public class ChunkProviderFlat implements IChunkProvider { this.e.add(new WorldGenVillage(map1)); } - if (map.containsKey("biome_1")) { + if (map.containsKey("biome_1") && world.paperSpigotConfig.generateTemple) { // PaperSpigot this.e.add(new WorldGenLargeFeature((Map) map.get("biome_1"))); } - if (map.containsKey("mineshaft")) { + if (map.containsKey("mineshaft") && world.paperSpigotConfig.generateMineshaft) { // PaperSpigot this.e.add(new WorldGenMineshaft((Map) map.get("mineshaft"))); } - if (map.containsKey("stronghold")) { + if (map.containsKey("stronghold") && world.paperSpigotConfig.generateStronghold) { // PaperSpigot this.e.add(new WorldGenStronghold((Map) map.get("stronghold"))); } - if (map.containsKey("oceanmonument")) { + if (map.containsKey("oceanmonument") && world.paperSpigotConfig.generateMonument) { // PaperSpigot this.e.add(new WorldGenMonument((Map) map.get("oceanmonument"))); } } @@ -61,7 +61,7 @@ public class ChunkProviderFlat implements IChunkProvider { this.i = new WorldGenLakes(Blocks.LAVA); } - this.g = this.d.b().containsKey("dungeon"); + this.g = world.paperSpigotConfig.generateDungeon && this.d.b().containsKey("dungeon"); // PaperSpigot 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 e0be3c1..ad464d3 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderGenerate.java +++ b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java @@ -156,31 +156,31 @@ public class ChunkProviderGenerate implements IChunkProvider { this.a(i, j, chunksnapshot); this.B = this.m.getWorldChunkManager().getBiomeBlock(this.B, i * 16, j * 16, 16, 16); this.a(i, j, chunksnapshot, this.B); - if (this.r.r) { + if (this.r.r && this.m.paperSpigotConfig.generateCaves) { // PaperSpigot this.u.a(this, this.m, i, j, chunksnapshot); } - if (this.r.z) { + if (this.r.z && this.m.paperSpigotConfig.generateCanyon) { // PaperSpigot this.z.a(this, this.m, i, j, chunksnapshot); } - if (this.r.w && this.n) { + if (this.r.w && this.n && this.m.paperSpigotConfig.generateMineshaft) { // PaperSpigot this.x.a(this, this.m, i, j, chunksnapshot); } - if (this.r.v && this.n) { + if (this.r.v && this.n && this.m.paperSpigotConfig.generateVillage) { // PaperSpigot this.w.a(this, this.m, i, j, chunksnapshot); } - if (this.r.u && this.n) { + if (this.r.u && this.n && this.m.paperSpigotConfig.generateStronghold) { // PaperSpigot this.v.a(this, this.m, i, j, chunksnapshot); } - if (this.r.x && this.n) { + if (this.r.x && this.n && this.m.paperSpigotConfig.generateTemple) { // PaperSpigot this.y.a(this, this.m, i, j, chunksnapshot); } - if (this.r.y && this.n) { + if (this.r.y && this.n && this.m.paperSpigotConfig.generateMonument) { // PaperSpigot this.A.a(this, this.m, i, j, chunksnapshot); } @@ -319,23 +319,23 @@ public class ChunkProviderGenerate implements IChunkProvider { boolean flag = false; ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); - if (this.r.w && this.n) { + if (this.r.w && this.n && this.m.paperSpigotConfig.generateMineshaft) { // PaperSpigot this.x.a(this.m, this.h, chunkcoordintpair); } - if (this.r.v && this.n) { + if (this.r.v && this.n && this.m.paperSpigotConfig.generateVillage) { // PaperSpigot flag = this.w.a(this.m, this.h, chunkcoordintpair); } - if (this.r.u && this.n) { + if (this.r.u && this.n && this.m.paperSpigotConfig.generateStronghold) { // PaperSpigot this.v.a(this.m, this.h, chunkcoordintpair); } - if (this.r.x && this.n) { + if (this.r.x && this.n && this.m.paperSpigotConfig.generateTemple) { // PaperSpigot this.y.a(this.m, this.h, chunkcoordintpair); } - if (this.r.y && this.n) { + if (this.r.y && this.n && this.m.paperSpigotConfig.generateMonument) { // PaperSpigot this.A.a(this.m, this.h, chunkcoordintpair); } @@ -359,7 +359,7 @@ public class ChunkProviderGenerate implements IChunkProvider { } } - if (this.r.s) { + if (this.r.s && this.m.paperSpigotConfig.generateDungeon) { // PaperSpigot for (k1 = 0; k1 < this.r.t; ++k1) { l1 = this.h.nextInt(16) + 8; i2 = this.h.nextInt(256); @@ -444,23 +444,23 @@ public class ChunkProviderGenerate implements IChunkProvider { } public void recreateStructures(Chunk chunk, int i, int j) { - if (this.r.w && this.n) { + if (this.r.w && this.n && this.m.paperSpigotConfig.generateMineshaft) { // PaperSpigot this.x.a(this, this.m, i, j, (ChunkSnapshot) null); } - if (this.r.v && this.n) { + if (this.r.v && this.n && this.m.paperSpigotConfig.generateVillage) { // PaperSpigot this.w.a(this, this.m, i, j, (ChunkSnapshot) null); } - if (this.r.u && this.n) { + if (this.r.u && this.n && this.m.paperSpigotConfig.generateStronghold) { // PaperSpigot this.v.a(this, this.m, i, j, (ChunkSnapshot) null); } - if (this.r.x && this.n) { + if (this.r.x && this.n && this.m.paperSpigotConfig.generateTemple) { // PaperSpigot this.y.a(this, this.m, i, j, (ChunkSnapshot) null); } - if (this.r.y && this.n) { + if (this.r.y && this.n && this.m.paperSpigotConfig.generateMonument) { // PaperSpigot this.A.a(this, this.m, 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 2f01bbf..0156892 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderHell.java +++ b/src/main/java/net/minecraft/server/ChunkProviderHell.java @@ -142,7 +142,10 @@ public class ChunkProviderHell implements IChunkProvider { IBlockData iblockdata1 = Blocks.NETHERRACK.getBlockData(); for (int l1 = 127; l1 >= 0; --l1) { - if (l1 < 127 - this.j.nextInt(5) && l1 > this.j.nextInt(5)) { + // PaperSpigot start - Configurable flat bedrock worldgen + if (l1 < 127 - (h.paperSpigotConfig.generateFlatBedrock ? 0 : this.j.nextInt(5)) && + l1 > (h.paperSpigotConfig.generateFlatBedrock ? 0 : this.j.nextInt(5))) { + // PaperSpigot end IBlockData iblockdata2 = chunksnapshot.a(i1, l1, l); if (iblockdata2.getBlock() != null && iblockdata2.getBlock().getMaterial() != Material.AIR) { @@ -198,8 +201,8 @@ public class ChunkProviderHell implements IChunkProvider { this.a(i, j, chunksnapshot); this.b(i, j, chunksnapshot); - this.C.a(this, this.h, i, j, chunksnapshot); - if (this.i) { + if (this.h.paperSpigotConfig.generateCaves) this.C.a(this, this.h, i, j, chunksnapshot); // PaperSpigot + if (this.i && this.h.paperSpigotConfig.generateFortress) { // PaperSpigot this.B.a(this, this.h, i, j, chunksnapshot); } @@ -384,7 +387,7 @@ public class ChunkProviderHell implements IChunkProvider { } public void recreateStructures(Chunk chunk, int i, int j) { - this.B.a(this, this.h, i, j, (ChunkSnapshot) null); + if (this.h.paperSpigotConfig.generateFortress) this.B.a(this, this.h, i, j, (ChunkSnapshot) null); // PaperSpigot } public Chunk getChunkAt(BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java index 0f8211a..e76acfc 100644 --- a/src/main/java/net/minecraft/server/StructureGenerator.java +++ b/src/main/java/net/minecraft/server/StructureGenerator.java @@ -88,6 +88,7 @@ public abstract class StructureGenerator extends WorldGenBase { } public boolean b(BlockPosition blockposition) { + if (this.c == null) return false; // PaperSpigot this.a(this.c); return this.c(blockposition) != null; } @@ -115,6 +116,7 @@ public abstract class StructureGenerator extends WorldGenBase { } public boolean a(World world, BlockPosition blockposition) { + if (this.c == null) return false; // PaperSpigot this.a(world); Iterator iterator = this.e.values().iterator(); diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java index f51962e..8338cc6 100644 --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java @@ -275,4 +275,28 @@ public class PaperSpigotWorldConfig loadUnloadedTNTEntities = getBoolean( "load-chunks.tnt-entities", false ); loadUnloadedFallingBlocks = getBoolean( "load-chunks.falling-blocks", false ); } + + 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 ); + } } -- 1.9.5.msysgit.1