From f4c7c7b564502acf29d729289e119295a5a18a2a Mon Sep 17 00:00:00 2001 From: Matt Caughey Date: Tue, 18 Mar 2014 17:45:58 -0400 Subject: [PATCH] Fixed boulder gen for tundras/wastelands --- .../common/biomes/BiomeGenHighland.java | 1 + .../common/biomes/BiomeGenTundra.java | 4 +- .../common/biomes/BiomeGenWasteland.java | 2 +- .../world/features/WorldGenBOPBlob.java | 101 ++++++++++++++++++ .../PlainsForcedDecorator.java | 1 - .../generation/WorldGenFieldAssociation.java | 4 +- 6 files changed, 107 insertions(+), 6 deletions(-) create mode 100644 src/main/java/biomesoplenty/common/world/features/WorldGenBOPBlob.java diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenHighland.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenHighland.java index a3a56b742..5a6570ab4 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenHighland.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenHighland.java @@ -25,6 +25,7 @@ public class BiomeGenHighland extends BOPBiome this.theBiomeDecorator.grassPerChunk = 99; this.bopWorldFeatures.setFeature("wildCarrotsPerChunk", 1); + this.bopWorldFeatures.setFeature("rockpilesPerChunk", 3); weightedGrassGen.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 10), 0.25D); weightedGrassGen.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 11), 0.25D); diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenTundra.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenTundra.java index 8377a5691..200f90551 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenTundra.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenTundra.java @@ -27,7 +27,7 @@ public class BiomeGenTundra extends BOPBiome this.spawnableCreatureList.clear(); - this.theBiomeDecorator.treesPerChunk = 5; + this.theBiomeDecorator.treesPerChunk = 3; this.theBiomeDecorator.grassPerChunk = 8; this.theBiomeDecorator.flowersPerChunk = -999; this.theBiomeDecorator.reedsPerChunk = -999; @@ -36,7 +36,7 @@ public class BiomeGenTundra extends BOPBiome this.bopWorldFeatures.setFeature("bopFlowersPerChunk", 1); this.bopWorldFeatures.setFeature("shrubsPerChunk", 2); this.bopWorldFeatures.setFeature("waterReedsPerChunk", 2); - this.bopWorldFeatures.setFeature("rockpilesPerChunk", 25); + this.bopWorldFeatures.setFeature("rockpilesPerChunk", 2); this.bopWorldFeatures.setFeature("leafPilesPerChunk", 5); this.bopWorldFeatures.setFeature("deadLeafPilesPerChunk", 5); diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenWasteland.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenWasteland.java index 60836e605..6e59c56c4 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenWasteland.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenWasteland.java @@ -38,7 +38,7 @@ public class BiomeGenWasteland extends BOPBiome this.bopWorldFeatures.setFeature("wasteland2PerChunk", 1); this.bopWorldFeatures.setFeature("wasteland3PerChunk", 1); this.bopWorldFeatures.setFeature("wasteland4PerChunk", 1); - this.bopWorldFeatures.setFeature("wastelandRockPilesPerChunk", 1); + this.bopWorldFeatures.setFeature("wastelandRockPilesPerChunk", 2); weightedGrassGen.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("plants"), 0), 1D); } diff --git a/src/main/java/biomesoplenty/common/world/features/WorldGenBOPBlob.java b/src/main/java/biomesoplenty/common/world/features/WorldGenBOPBlob.java new file mode 100644 index 000000000..9041103e6 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenBOPBlob.java @@ -0,0 +1,101 @@ +package biomesoplenty.common.world.features; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import biomesoplenty.common.world.decoration.BOPDecorationManager; +import biomesoplenty.common.world.generation.WorldGeneratorBOP; + +public class WorldGenBOPBlob extends WorldGeneratorBOP +{ + private Block field_150545_a; + private int field_150544_b; + private static final String __OBFID = "CL_00000402"; + + public WorldGenBOPBlob(Block p_i45450_1_, int p_i45450_2_) + { + super(false); + this.field_150545_a = p_i45450_1_; + this.field_150544_b = p_i45450_2_; + } + + public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) + { + while (true) + { + if (par4 > 3) + { + label63: + { + if (!par1World.isAirBlock(par3, par4 - 1, par5)) + { + Block block = par1World.getBlock(par3, par4 - 1, par5); + + if (block == Blocks.grass || block == Blocks.dirt || block == Blocks.stone) + { + break label63; + } + } + + --par4; + continue; + } + } + + if (par4 <= 3) + { + return false; + } + + int k2 = this.field_150544_b; + + for (int l = 0; k2 >= 0 && l < 3; ++l) + { + int i1 = k2 + par2Random.nextInt(2); + int j1 = k2 + par2Random.nextInt(2); + int k1 = k2 + par2Random.nextInt(2); + float f = (float)(i1 + j1 + k1) * 0.333F + 0.5F; + + for (int l1 = par3 - i1; l1 <= par3 + i1; ++l1) + { + for (int i2 = par5 - k1; i2 <= par5 + k1; ++i2) + { + for (int j2 = par4 - j1; j2 <= par4 + j1; ++j2) + { + float f1 = (float)(l1 - par3); + float f2 = (float)(i2 - par5); + float f3 = (float)(j2 - par4); + + if (f1 * f1 + f2 * f2 + f3 * f3 <= f * f) + { + par1World.setBlock(l1, j2, i2, this.field_150545_a, 0, 4); + } + } + } + } + + par3 += -(k2 + 1) + par2Random.nextInt(2 + k2 * 2); + par5 += -(k2 + 1) + par2Random.nextInt(2 + k2 * 2); + par4 += 0 - par2Random.nextInt(2); + } + + return true; + } + } + + @Override + public void setupGeneration(World world, Random random, BiomeGenBase biome, String featureName, int x, int z) + { + for (int i = 0; i < (Integer)BOPDecorationManager.getBiomeFeatures(biome.biomeID).getFeature(featureName); i++) + { + int randX = x + random.nextInt(16) + 8; + int randZ = z + random.nextInt(16) + 8; + int randY = random.nextInt(world.getHeightValue(randX, randZ) * 2); + + this.generate(world, random, randX, randY, randZ); + } + } +} \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/world/forceddecorators/PlainsForcedDecorator.java b/src/main/java/biomesoplenty/common/world/forceddecorators/PlainsForcedDecorator.java index 0910dd4f7..71f7bc255 100644 --- a/src/main/java/biomesoplenty/common/world/forceddecorators/PlainsForcedDecorator.java +++ b/src/main/java/biomesoplenty/common/world/forceddecorators/PlainsForcedDecorator.java @@ -11,7 +11,6 @@ public class PlainsForcedDecorator extends ForcedDecorator public PlainsForcedDecorator() { this.bopWorldFeatures.setFeature("bopFlowersPerChunk", 8); - this.bopWorldFeatures.setFeature("wildCarrotsPerChunk", 1); this.weightedFlowerGen.put(new WorldGenBOPFlora(BOPBlockHelper.get("flowers"), 0), 10); this.weightedFlowerGen.put(new WorldGenBOPFlora(BOPBlockHelper.get("flowers"), 9), 5); diff --git a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java index 1ca6b8a43..b8a9e129b 100644 --- a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java +++ b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java @@ -62,8 +62,8 @@ public class WorldGenFieldAssociation associateFeature("minersDelightPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("flowers2"), 6)); associateFeature("rootsPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("plants"), 15)); associateFeature("grassSplatterPerChunk", new WorldGenGrassSplatter()); - associateFeature("rockpilesPerChunk", new WorldGenBlockBlob(Blocks.stone, 0)); - associateFeature("wastelandRockPilesPerChunk", new WorldGenBlockBlob(BOPBlockHelper.get("driedDirt"), 0)); + associateFeature("rockpilesPerChunk", new WorldGenBOPBlob(Blocks.cobblestone, 0)); + associateFeature("wastelandRockPilesPerChunk", new WorldGenBOPBlob(BOPBlockHelper.get("driedDirt"), 0)); associateFeature("logsPerChunk", new WorldGenLog()); associateFeature("lavaSpoutsPerChunk", new WorldGenLavaSpout()); associateFeature("cobwebsPerChunk", new WorldGenBOPFlora(Blocks.web, 0));