--- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java
+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java
@@ -24,6 +24,11 @@
 import net.minecraft.world.gen.structure.MapGenStronghold;
 import net.minecraft.world.gen.structure.MapGenVillage;
 import net.minecraft.world.gen.structure.StructureOceanMonument;
+import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.*;
+import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.*;
+import net.minecraftforge.common.*;
+import net.minecraftforge.fml.common.eventhandler.Event.*;
+import net.minecraftforge.event.terraingen.*;
 
 public class ChunkProviderGenerate implements IChunkProvider
 {
@@ -57,6 +62,15 @@
     double[] field_147426_g;
     private static final String __OBFID = "CL_00000396";
 
+    {
+        field_73226_t = TerrainGen.getModdedMapGen(field_73226_t, CAVE);
+        field_73225_u = (MapGenStronghold) TerrainGen.getModdedMapGen(field_73225_u, STRONGHOLD);
+        field_73224_v = (MapGenVillage) TerrainGen.getModdedMapGen(field_73224_v, VILLAGE);
+        field_73223_w = (MapGenMineshaft) TerrainGen.getModdedMapGen(field_73223_w, MINESHAFT);
+        field_73233_x = (MapGenScatteredFeature) TerrainGen.getModdedMapGen(field_73233_x, SCATTERED_FEATURE);
+        field_73232_y = TerrainGen.getModdedMapGen(field_73232_y, RAVINE);
+    }
+
     public ChunkProviderGenerate(World p_i45636_1_, long p_i45636_2_, boolean p_i45636_4_, String p_i45636_5_)
     {
         this.field_177476_s = Blocks.field_150355_j;
@@ -96,6 +110,16 @@
             this.field_177477_r = ChunkProviderSettings.Factory.func_177865_a(p_i45636_5_).func_177864_b();
             this.field_177476_s = this.field_177477_r.field_177778_E ? Blocks.field_150353_l : Blocks.field_150355_j;
         }
+
+        NoiseGenerator[] noiseGens = {field_147431_j, field_147432_k, field_147429_l, field_147430_m, field_73214_a, field_73212_b, field_73213_c};
+        noiseGens = TerrainGen.getModdedNoiseGenerators(p_i45636_1_, this.field_73220_k, noiseGens);
+        this.field_147431_j = (NoiseGeneratorOctaves)noiseGens[0];
+        this.field_147432_k = (NoiseGeneratorOctaves)noiseGens[1];
+        this.field_147429_l = (NoiseGeneratorOctaves)noiseGens[2];
+        this.field_147430_m = (NoiseGeneratorPerlin)noiseGens[3];
+        this.field_73214_a = (NoiseGeneratorOctaves)noiseGens[4];
+        this.field_73212_b = (NoiseGeneratorOctaves)noiseGens[5];
+        this.field_73213_c = (NoiseGeneratorOctaves)noiseGens[6];
     }
 
     public void func_180518_a(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_)
@@ -169,6 +193,10 @@
 
     public void func_180517_a(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_)
     {
+        ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180517_1_, p_180517_2_, p_180517_3_, this.field_73230_p);
+        MinecraftForge.EVENT_BUS.post(event);
+        if (event.getResult() == Result.DENY) return;
+
         double d0 = 0.03125D;
         this.field_73227_s = this.field_147430_m.func_151599_a(this.field_73227_s, (double)(p_180517_1_ * 16), (double)(p_180517_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);
 
@@ -375,6 +403,8 @@
         boolean flag = false;
         ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_);
 
+        MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag));
+
         if (this.field_177477_r.field_177829_w && this.field_73229_q)
         {
             this.field_73223_w.func_175794_a(this.field_73230_p, this.field_73220_k, chunkcoordintpair);
@@ -404,7 +434,8 @@
         int l1;
         int i2;
 
-        if (biomegenbase != BiomeGenBase.field_76769_d && biomegenbase != BiomeGenBase.field_76786_s && this.field_177477_r.field_177781_A && !flag && this.field_73220_k.nextInt(this.field_177477_r.field_177782_B) == 0)
+        if (biomegenbase != BiomeGenBase.field_76769_d && biomegenbase != BiomeGenBase.field_76786_s && this.field_177477_r.field_177781_A && !flag && this.field_73220_k.nextInt(this.field_177477_r.field_177782_B) == 0
+            && TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, LAKE))
         {
             k1 = this.field_73220_k.nextInt(16) + 8;
             l1 = this.field_73220_k.nextInt(256);
@@ -412,7 +443,7 @@
             (new WorldGenLakes(Blocks.field_150355_j)).func_180709_b(this.field_73230_p, this.field_73220_k, blockpos.func_177982_a(k1, l1, i2));
         }
 
-        if (!flag && this.field_73220_k.nextInt(this.field_177477_r.field_177777_D / 10) == 0 && this.field_177477_r.field_177783_C)
+        if (TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, LAVA) && !flag && this.field_73220_k.nextInt(this.field_177477_r.field_177777_D / 10) == 0 && this.field_177477_r.field_177783_C)
         {
             k1 = this.field_73220_k.nextInt(16) + 8;
             l1 = this.field_73220_k.nextInt(this.field_73220_k.nextInt(248) + 8);
@@ -426,7 +457,8 @@
 
         if (this.field_177477_r.field_177837_s)
         {
-            for (k1 = 0; k1 < this.field_177477_r.field_177835_t; ++k1)
+            boolean doGen = TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, DUNGEON);
+            for (k1 = 0; doGen && k1 < this.field_177477_r.field_177835_t; ++k1)
             {
                 l1 = this.field_73220_k.nextInt(16) + 8;
                 i2 = this.field_73220_k.nextInt(256);
@@ -436,10 +468,14 @@
         }
 
         biomegenbase.func_180624_a(this.field_73230_p, this.field_73220_k, new BlockPos(k, 0, l));
+        if (TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, ANIMALS))
+        {
         SpawnerAnimals.func_77191_a(this.field_73230_p, biomegenbase, k + 8, l + 8, 16, 16, this.field_73220_k);
+        }
         blockpos = blockpos.func_177982_a(8, 0, 8);
 
-        for (k1 = 0; k1 < 16; ++k1)
+        boolean doGen = TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, ICE);
+        for (k1 = 0; doGen && k1 < 16; ++k1)
         {
             for (l1 = 0; l1 < 16; ++l1)
             {
@@ -458,6 +494,8 @@
             }
         }
 
+        MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag));
+
         BlockFalling.field_149832_M = false;
     }
 
