From 69cd689352ceb99b615eb1bd4d3216b06e331093 Mon Sep 17 00:00:00 2001 From: Amnet Date: Sat, 26 Oct 2013 18:44:05 +0200 Subject: [PATCH] Fixed ocean generation. Added new Terrain Gen option. --- .../BOPConfigurationTerrainGen.java | 3 ++ .../world/layer/BiomeLayerBiomes.java | 9 +---- .../world/layer/BiomeLayerCreate.java | 33 ++++++++++++------- .../world/layer/BiomeLayerRiverMix.java | 3 +- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/common/biomesoplenty/configuration/configfile/BOPConfigurationTerrainGen.java b/common/biomesoplenty/configuration/configfile/BOPConfigurationTerrainGen.java index 4e59fb698..b0b78df6f 100644 --- a/common/biomesoplenty/configuration/configfile/BOPConfigurationTerrainGen.java +++ b/common/biomesoplenty/configuration/configfile/BOPConfigurationTerrainGen.java @@ -26,6 +26,7 @@ public class BOPConfigurationTerrainGen public static boolean burningBlossomGen; public static int villageDistance; + public static int landmassPercentage; // Village biomes public static boolean alpsVillage; @@ -140,6 +141,8 @@ public class BOPConfigurationTerrainGen { villageDistance = 8; } + + landmassPercentage = config.get("Biomes O\' Plenty World Type Settings", "Landmass Percentage", 10, "In Vanilla it is set to 10. Takes values from 0 to 100.").getInt(); // Biomes with villages alpsVillage = config.get("Allow Villages", "Alps", false).getBoolean(false); diff --git a/common/biomesoplenty/world/layer/BiomeLayerBiomes.java b/common/biomesoplenty/world/layer/BiomeLayerBiomes.java index 3a966b89a..bc32f63bc 100644 --- a/common/biomesoplenty/world/layer/BiomeLayerBiomes.java +++ b/common/biomesoplenty/world/layer/BiomeLayerBiomes.java @@ -83,13 +83,6 @@ public class BiomeLayerBiomes extends BiomeLayer netherBiomes.add(Biomes.netherBone.get()); } } - if (Biomes.netherBlood.isPresent()) - { - if (BOPConfigurationBiomeGen.bloodyHeapGen) - { - netherBiomes.add(Biomes.netherBlood.get()); - } - } if (Biomes.netherBiomes.size() > 0) { netherBiomes.addAll(Biomes.netherBiomes); @@ -116,7 +109,7 @@ public class BiomeLayerBiomes extends BiomeLayer int[] var5 = this.parent.getInts(par1, par2, par3, par4); int[] var6 = IntCache.getIntCache(par3 * par4); - boolean abyss = Biomes.oceanCoral.isPresent(); + boolean abyss = Biomes.oceanAbyss.isPresent(); boolean coral = Biomes.oceanCoral.isPresent(); boolean kelp = Biomes.oceanKelp.isPresent(); diff --git a/common/biomesoplenty/world/layer/BiomeLayerCreate.java b/common/biomesoplenty/world/layer/BiomeLayerCreate.java index 0a0313f8e..2688ada84 100644 --- a/common/biomesoplenty/world/layer/BiomeLayerCreate.java +++ b/common/biomesoplenty/world/layer/BiomeLayerCreate.java @@ -3,9 +3,14 @@ package biomesoplenty.world.layer; import net.minecraft.world.gen.layer.IntCache; import biomesoplenty.api.Biomes; import biomesoplenty.configuration.configfile.BOPConfigurationBiomeGen; +import biomesoplenty.configuration.configfile.BOPConfigurationTerrainGen; public class BiomeLayerCreate extends BiomeLayer { + final private int ABYSS_CHANCE = 2; + final private int CORAL_CHANCE = 5; + final private int KELP_CHANCE = 5; + public BiomeLayerCreate(long par1, boolean o) { super(par1); @@ -18,8 +23,8 @@ public class BiomeLayerCreate extends BiomeLayer boolean ocean = BOPConfigurationBiomeGen.oceanGen; boolean abyss = Biomes.oceanAbyss.isPresent(); - boolean coral = Biomes.oceanCoral.isPresent(); - boolean kelp = Biomes.oceanKelp.isPresent(); + boolean coral = Biomes.oceanCoral.isPresent(); + boolean kelp = Biomes.oceanKelp.isPresent(); for (int var6 = 0; var6 < par4; ++var6) { @@ -28,10 +33,19 @@ public class BiomeLayerCreate extends BiomeLayer this.initChunkSeed(par1 + var7, par2 + var6); if(ocean) { - if(abyss) { var5[var7 + var6 * par3] = this.nextInt(50) == 0 ? 1 : Biomes.oceanAbyss.get().biomeID; } - else if(coral) { var5[var7 + var6 * par3] = this.nextInt(20) == 0 ? 1 : Biomes.oceanCoral.get().biomeID; } - else if(kelp) { var5[var7 + var6 * par3] = this.nextInt(20) == 0 ? 1 : Biomes.oceanKelp.get().biomeID; } - else { var5[var7 + var6 * par3] = this.nextInt(10) == 0 ? 1 : 0;} + if (this.nextInt(100) < BOPConfigurationTerrainGen.landmassPercentage) + { + var5[var7 + var6 * par3] = 1; + } + else + { + int oceanType = 0; + if (abyss && this.nextInt(100) < ABYSS_CHANCE) oceanType = Biomes.oceanAbyss.get().biomeID; + else if (coral && this.nextInt(100) < CORAL_CHANCE) oceanType = Biomes.oceanCoral.get().biomeID; + else if (kelp && this.nextInt(100) < KELP_CHANCE) oceanType = Biomes.oceanKelp.get().biomeID; + + var5[var7 + var6 * par3] = oceanType; + } } else { @@ -40,12 +54,9 @@ public class BiomeLayerCreate extends BiomeLayer } } - if(ocean) + if (par1 > -par3 && par1 <= 0 && par2 > -par4 && par2 <= 0) { - if (par1 > -par3 && par1 <= 0 && par2 > -par4 && par2 <= 0) - { - var5[-par1 + -par2 * par3] = 1; - } + var5[-par1 + -par2 * par3] = 1; } return var5; diff --git a/common/biomesoplenty/world/layer/BiomeLayerRiverMix.java b/common/biomesoplenty/world/layer/BiomeLayerRiverMix.java index 5619e5cf7..64afe7c57 100644 --- a/common/biomesoplenty/world/layer/BiomeLayerRiverMix.java +++ b/common/biomesoplenty/world/layer/BiomeLayerRiverMix.java @@ -1,5 +1,6 @@ package biomesoplenty.world.layer; +import biomesoplenty.api.Biomes; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.gen.layer.IntCache; @@ -32,7 +33,7 @@ public class BiomeLayerRiverMix extends BiomeLayer for (int var8 = 0; var8 < par3 * par4; ++var8) { - if (var5[var8] == BiomeGenBase.ocean.biomeID) + if (var5[var8] == BiomeGenBase.ocean.biomeID || var5[var8] == Biomes.oceanAbyss.get().biomeID || var5[var8] == Biomes.oceanCoral.get().biomeID || var5[var8] == Biomes.oceanKelp.get().biomeID) { var7[var8] = var5[var8]; }