From 5d1cb62cfd133f2696a402d85970527674f9cf82 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Fri, 18 Apr 2014 11:54:43 +1000 Subject: [PATCH] Readded the Phantasmagoric Inferno --- .../biomes/nether/BiomeGenBloodyHeap.java | 1 - .../nether/BiomeGenPhantasmagoricInferno.java | 11 +- .../configuration/BOPConfigurationIDs.java | 4 +- .../biomesoplenty/common/core/BOPBiomes.java | 2 + .../common/world/ChunkProviderBOPHell.java | 2 - .../world/decoration/BOPWorldFeatures.java | 2 + .../world/features/WorldGenBOPTallGrass.java | 32 ++-- .../managers/WorldGenBOPGrassManager.java | 2 +- .../features/nether/WorldGenLakesNether.java | 141 ++++++++++++++++++ .../generation/WorldGenFieldAssociation.java | 41 +++-- 10 files changed, 210 insertions(+), 28 deletions(-) create mode 100644 src/main/java/biomesoplenty/common/world/features/nether/WorldGenLakesNether.java diff --git a/src/main/java/biomesoplenty/common/biomes/nether/BiomeGenBloodyHeap.java b/src/main/java/biomesoplenty/common/biomes/nether/BiomeGenBloodyHeap.java index 75167d254..10e46c777 100644 --- a/src/main/java/biomesoplenty/common/biomes/nether/BiomeGenBloodyHeap.java +++ b/src/main/java/biomesoplenty/common/biomes/nether/BiomeGenBloodyHeap.java @@ -16,6 +16,5 @@ public class BiomeGenBloodyHeap extends BOPNetherBiome //customBiomeDecorator.gravesPerChunk = 1; this.bopWorldFeatures.setFeature("waspHivesPerChunk", 1); - //customBiomeDecorator.generateUndergroundLakes = false; } } diff --git a/src/main/java/biomesoplenty/common/biomes/nether/BiomeGenPhantasmagoricInferno.java b/src/main/java/biomesoplenty/common/biomes/nether/BiomeGenPhantasmagoricInferno.java index f438991e4..1792e883c 100644 --- a/src/main/java/biomesoplenty/common/biomes/nether/BiomeGenPhantasmagoricInferno.java +++ b/src/main/java/biomesoplenty/common/biomes/nether/BiomeGenPhantasmagoricInferno.java @@ -1,8 +1,9 @@ package biomesoplenty.common.biomes.nether; +import net.minecraft.world.gen.feature.WorldGenFire; import biomesoplenty.api.BOPBlockHelper; import biomesoplenty.common.biomes.BOPNetherBiome; -import net.minecraft.world.gen.feature.WorldGenFire; +import biomesoplenty.common.world.features.WorldGenBOPFlora; public class BiomeGenPhantasmagoricInferno extends BOPNetherBiome { @@ -15,8 +16,14 @@ public class BiomeGenPhantasmagoricInferno extends BOPNetherBiome this.topBlock = BOPBlockHelper.get("ash"); this.fillerBlock = BOPBlockHelper.get("ash"); + this.bopWorldFeatures.setFeature("netherLavaLakesPerChunk", 20); + this.bopWorldFeatures.setFeature("smolderingGrassPerChunk", 8); + //customBiomeDecorator.gravesPerChunk = 1; + this.bopWorldFeatures.setFeature("waspHivesPerChunk", 1); + this.bopWorldFeatures.setFeature("generateAsh", true); + this.bopWorldFeatures.setFeature("bopGrassPerChunk", 8); - + this.bopWorldFeatures.weightedGrassGen.put(new WorldGenFire(), 1D); } } diff --git a/src/main/java/biomesoplenty/common/configuration/BOPConfigurationIDs.java b/src/main/java/biomesoplenty/common/configuration/BOPConfigurationIDs.java index cd41a0c61..08379b6c0 100644 --- a/src/main/java/biomesoplenty/common/configuration/BOPConfigurationIDs.java +++ b/src/main/java/biomesoplenty/common/configuration/BOPConfigurationIDs.java @@ -69,7 +69,7 @@ public class BOPConfigurationIDs public static int netherGardenID; public static int netherDesertID; - public static int netherLavaID; + public static int netherPhantasmagoricInfernoID; public static int netherBoneID; public static int netherBloodyHeapID; @@ -182,7 +182,7 @@ public class BOPConfigurationIDs netherGardenID = config.get("Biome IDs", "Undergarden (Nether) ID", 185).getInt(); netherDesertID = config.get("Biome IDs", "Corrupted Sands (Nether) ID", 186).getInt(); - netherLavaID = config.get("Biome IDs", "Phantasmagoric Inferno (Nether) ID", 187).getInt(); + netherPhantasmagoricInfernoID = config.get("Biome IDs", "Phantasmagoric Inferno (Nether) ID", 187).getInt(); netherBoneID = config.get("Biome IDs", "Boneyard (Nether) ID", 188).getInt(); netherBloodyHeapID = config.get("Biome IDs", "Bloody Heap (Nether) ID", 189).getInt(); diff --git a/src/main/java/biomesoplenty/common/core/BOPBiomes.java b/src/main/java/biomesoplenty/common/core/BOPBiomes.java index e7fa5e1e4..696b87b0d 100644 --- a/src/main/java/biomesoplenty/common/core/BOPBiomes.java +++ b/src/main/java/biomesoplenty/common/core/BOPBiomes.java @@ -8,6 +8,7 @@ import net.minecraftforge.common.BiomeManager; import biomesoplenty.api.BOPBiomeHelper; import biomesoplenty.api.BOPBiomeHelper.TemperatureType; import biomesoplenty.common.biomes.nether.BiomeGenBloodyHeap; +import biomesoplenty.common.biomes.nether.BiomeGenPhantasmagoricInferno; import biomesoplenty.common.biomes.overworld.BiomeGenAlps; import biomesoplenty.common.biomes.overworld.BiomeGenArctic; import biomesoplenty.common.biomes.overworld.BiomeGenBambooForest; @@ -151,6 +152,7 @@ public class BOPBiomes registerBiome(new BiomeEntry(new BiomeGenWoodland(BOPConfigurationIDs.woodlandID).setBiomeName("Woodland"), TemperatureType.WARM, 10)); registerBiome(new BiomeEntry(new BiomeGenBloodyHeap(BOPConfigurationIDs.netherBloodyHeapID).setBiomeName("Bloody Heap"), 10), -1); + registerBiome(new BiomeEntry(new BiomeGenPhantasmagoricInferno(BOPConfigurationIDs.netherPhantasmagoricInfernoID).setBiomeName("Phantasmagoric Inferno"), 10), -1); } private static void addSpawnBiomes() diff --git a/src/main/java/biomesoplenty/common/world/ChunkProviderBOPHell.java b/src/main/java/biomesoplenty/common/world/ChunkProviderBOPHell.java index de73828ea..1d8a5471d 100644 --- a/src/main/java/biomesoplenty/common/world/ChunkProviderBOPHell.java +++ b/src/main/java/biomesoplenty/common/world/ChunkProviderBOPHell.java @@ -12,7 +12,6 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockFalling; -import net.minecraft.block.BlockSand; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.util.IProgressUpdate; @@ -32,7 +31,6 @@ import net.minecraft.world.gen.feature.WorldGenHellLava; import net.minecraft.world.gen.feature.WorldGenMinable; import net.minecraft.world.gen.structure.MapGenNetherBridge; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.terraingen.ChunkProviderEvent; import net.minecraftforge.event.terraingen.DecorateBiomeEvent; import net.minecraftforge.event.terraingen.PopulateChunkEvent; import net.minecraftforge.event.terraingen.TerrainGen; diff --git a/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java b/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java index 1a701ee1c..aab3ee798 100644 --- a/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java +++ b/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java @@ -79,6 +79,8 @@ public class BOPWorldFeatures addFeature("wasteland3PerChunk", 0); addFeature("wasteland4PerChunk", 0); addFeature("wastelandRockPilesPerChunk", 0); + addFeature("smolderingGrassPerChunk", 0); + addFeature("netherLavaLakesPerChunk", 0); //Nether Features addFeature("waspHivesPerChunk", 0); diff --git a/src/main/java/biomesoplenty/common/world/features/WorldGenBOPTallGrass.java b/src/main/java/biomesoplenty/common/world/features/WorldGenBOPTallGrass.java index 054288ab6..ddbc33046 100644 --- a/src/main/java/biomesoplenty/common/world/features/WorldGenBOPTallGrass.java +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenBOPTallGrass.java @@ -1,23 +1,25 @@ package biomesoplenty.common.world.features; -import biomesoplenty.common.world.decoration.BOPDecorationManager; -import biomesoplenty.common.world.generation.WorldGeneratorBOP; +import java.util.Random; + import net.minecraft.block.Block; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; - -import java.util.Random; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.decoration.BOPDecorationManager; +import biomesoplenty.common.world.generation.WorldGeneratorBOP; public class WorldGenBOPTallGrass extends WorldGeneratorBOP { private Block tallGrass; private int tallGrassMetadata; - public WorldGenBOPTallGrass(Block p_i45466_1_, int p_i45466_2_) + public WorldGenBOPTallGrass(Block tallGrass, int tallGrassMetadata) { - this.tallGrass = p_i45466_1_; - this.tallGrassMetadata = p_i45466_2_; + this.tallGrass = tallGrass; + this.tallGrassMetadata = tallGrassMetadata; } @Override @@ -41,9 +43,19 @@ public class WorldGenBOPTallGrass extends WorldGeneratorBOP int j1 = y + random.nextInt(4) - random.nextInt(4); int k1 = z + random.nextInt(8) - random.nextInt(8); - if (world.isAirBlock(i1, j1, k1) && this.tallGrass.canReplace(world, i1, j1, k1, 0, new ItemStack(this.tallGrass, 1, this.tallGrassMetadata))) + if (this.tallGrass == BOPBlockHelper.get("grass")) { - world.setBlock(i1, j1, k1, this.tallGrass, this.tallGrassMetadata, 2); + if (world.isAirBlock(i1, j1, k1) && world.getBlock(i1, j1 - 1, k1) == BOPBlockHelper.get("ash") || world.getBlock(i1, j1 - 1, k1) == Blocks.netherrack) + { + world.setBlock(i1, j1 - 1, k1, this.tallGrass, this.tallGrassMetadata, 2); + } + } + else + { + if (world.isAirBlock(i1, j1, k1) && (this.tallGrass.canReplace(world, i1, j1, k1, 0, new ItemStack(this.tallGrass, 1, this.tallGrassMetadata)))) + { + world.setBlock(i1, j1, k1, this.tallGrass, this.tallGrassMetadata, 2); + } } } @@ -57,7 +69,7 @@ public class WorldGenBOPTallGrass extends WorldGeneratorBOP { int randX = x + random.nextInt(16) + 8; int randZ = z + random.nextInt(16) + 8; - int randY = random.nextInt(world.getHeightValue(randX, randZ) * 2); + int randY = this.tallGrass == BOPBlockHelper.get("grass") ? random.nextInt(256) : random.nextInt(world.getHeightValue(randX, randZ) * 2); this.generate(world, random, randX, randY, randZ); } diff --git a/src/main/java/biomesoplenty/common/world/features/managers/WorldGenBOPGrassManager.java b/src/main/java/biomesoplenty/common/world/features/managers/WorldGenBOPGrassManager.java index 03ff7014d..440cea2df 100644 --- a/src/main/java/biomesoplenty/common/world/features/managers/WorldGenBOPGrassManager.java +++ b/src/main/java/biomesoplenty/common/world/features/managers/WorldGenBOPGrassManager.java @@ -38,7 +38,7 @@ public class WorldGenBOPGrassManager extends WorldGeneratorBOP { int randX = x + random.nextInt(16) + 8; int randZ = z + random.nextInt(16) + 8; - int randY = random.nextInt(world.getHeightValue(randX, randZ) * 2); + int randY = random.nextInt(256); this.generate(world, random, randX, randY, randZ); } diff --git a/src/main/java/biomesoplenty/common/world/features/nether/WorldGenLakesNether.java b/src/main/java/biomesoplenty/common/world/features/nether/WorldGenLakesNether.java new file mode 100644 index 000000000..c18a55739 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/nether/WorldGenLakesNether.java @@ -0,0 +1,141 @@ +package biomesoplenty.common.world.features.nether; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.world.EnumSkyBlock; +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 WorldGenLakesNether extends WorldGeneratorBOP +{ + public boolean generate(World world, Random rand, int x, int y, int z) + { + x -= 8; + + for (z -= 8; y > 5 && world.isAirBlock(x, y, z); --y) + { + ; + } + + if (y <= 4) + { + return false; + } + else + { + y -= 4; + boolean[] aboolean = new boolean[2048]; + int l = rand.nextInt(4) + 4; + int i1; + + for (i1 = 0; i1 < l; ++i1) + { + double d0 = rand.nextDouble() * 6.0D + 3.0D; + double d1 = rand.nextDouble() * 4.0D + 2.0D; + double d2 = rand.nextDouble() * 6.0D + 3.0D; + double d3 = rand.nextDouble() * (16.0D - d0 - 2.0D) + 1.0D + d0 / 2.0D; + double d4 = rand.nextDouble() * (8.0D - d1 - 4.0D) + 2.0D + d1 / 2.0D; + double d5 = rand.nextDouble() * (16.0D - d2 - 2.0D) + 1.0D + d2 / 2.0D; + + for (int k1 = 1; k1 < 15; ++k1) + { + for (int l1 = 1; l1 < 15; ++l1) + { + for (int i2 = 1; i2 < 7; ++i2) + { + double d6 = ((double)k1 - d3) / (d0 / 2.0D); + double d7 = ((double)i2 - d4) / (d1 / 2.0D); + double d8 = ((double)l1 - d5) / (d2 / 2.0D); + double d9 = d6 * d6 + d7 * d7 + d8 * d8; + + if (d9 < 1.0D) + { + aboolean[(k1 * 16 + l1) * 8 + i2] = true; + } + } + } + } + } + + int j1; + int j2; + boolean flag; + + for (i1 = 0; i1 < 16; ++i1) + { + for (j2 = 0; j2 < 16; ++j2) + { + for (j1 = 0; j1 < 8; ++j1) + { + flag = !aboolean[(i1 * 16 + j2) * 8 + j1] && (i1 < 15 && aboolean[((i1 + 1) * 16 + j2) * 8 + j1] || i1 > 0 && aboolean[((i1 - 1) * 16 + j2) * 8 + j1] || j2 < 15 && aboolean[(i1 * 16 + j2 + 1) * 8 + j1] || j2 > 0 && aboolean[(i1 * 16 + (j2 - 1)) * 8 + j1] || j1 < 7 && aboolean[(i1 * 16 + j2) * 8 + j1 + 1] || j1 > 0 && aboolean[(i1 * 16 + j2) * 8 + (j1 - 1)]); + + if (flag) + { + Material material = world.getBlock(x + i1, y + j1, z + j2).getMaterial(); + + if (j1 >= 4 && material.isLiquid()) + { + return false; + } + + if (j1 < 4 && !material.isSolid() && world.getBlock(x + i1, y + j1, z + j2) != Blocks.lava) + { + return false; + } + } + } + } + } + + for (i1 = 0; i1 < 16; ++i1) + { + for (j2 = 0; j2 < 16; ++j2) + { + for (j1 = 0; j1 < 8; ++j1) + { + if (aboolean[(i1 * 16 + j2) * 8 + j1]) + { + world.setBlock(x + i1, y + j1, z + j2, j1 >= 4 ? Blocks.air : Blocks.lava, 0, 2); + } + } + } + } + + for (i1 = 0; i1 < 16; ++i1) + { + for (j2 = 0; j2 < 16; ++j2) + { + for (j1 = 0; j1 < 8; ++j1) + { + flag = !aboolean[(i1 * 16 + j2) * 8 + j1] && (i1 < 15 && aboolean[((i1 + 1) * 16 + j2) * 8 + j1] || i1 > 0 && aboolean[((i1 - 1) * 16 + j2) * 8 + j1] || j2 < 15 && aboolean[(i1 * 16 + j2 + 1) * 8 + j1] || j2 > 0 && aboolean[(i1 * 16 + (j2 - 1)) * 8 + j1] || j1 < 7 && aboolean[(i1 * 16 + j2) * 8 + j1 + 1] || j1 > 0 && aboolean[(i1 * 16 + j2) * 8 + (j1 - 1)]); + + if (flag && (j1 < 4 || rand.nextInt(2) != 0) && world.getBlock(x + i1, y + j1, z + j2).getMaterial().isSolid()) + { + world.setBlock(x + i1, y + j1, z + j2, Blocks.netherrack, 0, 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 randY = random.nextInt(random.nextInt(random.nextInt(112) + 8) + 8); + int randZ = z + random.nextInt(16) + 8; + + this.generate(world, random, randX, randY, randZ); + } + } +} diff --git a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java index e8043c370..28f9507e1 100644 --- a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java +++ b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java @@ -1,20 +1,38 @@ package biomesoplenty.common.world.generation; -import biomesoplenty.api.BOPBlockHelper; -import biomesoplenty.common.world.features.*; -import biomesoplenty.common.world.features.managers.WorldGenBOPFlowerManager; -import biomesoplenty.common.world.features.managers.WorldGenBOPGrassManager; -import biomesoplenty.common.world.features.nether.WorldGenWaspHive; -import biomesoplenty.common.world.forcedgenerators.LakesForcedGenerator; -import biomesoplenty.common.world.forcedgenerators.MelonForcedGenerator; -import biomesoplenty.common.world.forcedgenerators.PondForcedGenerator; +import java.util.HashMap; + import net.minecraft.init.Blocks; import net.minecraft.world.gen.feature.WorldGenLakes; import net.minecraft.world.gen.feature.WorldGenLiquids; import net.minecraft.world.gen.feature.WorldGenMelon; import net.minecraft.world.gen.feature.WorldGenerator; - -import java.util.HashMap; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.features.WorldGenBOPBlob; +import biomesoplenty.common.world.features.WorldGenBOPCoral; +import biomesoplenty.common.world.features.WorldGenBOPDoubleFlora; +import biomesoplenty.common.world.features.WorldGenBOPFlora; +import biomesoplenty.common.world.features.WorldGenBOPTallGrass; +import biomesoplenty.common.world.features.WorldGenBOPUndergroundDecoration; +import biomesoplenty.common.world.features.WorldGenCobwebNest; +import biomesoplenty.common.world.features.WorldGenGrassSplatter; +import biomesoplenty.common.world.features.WorldGenLavaSpout; +import biomesoplenty.common.world.features.WorldGenLog; +import biomesoplenty.common.world.features.WorldGenRiverCane; +import biomesoplenty.common.world.features.WorldGenSplotches; +import biomesoplenty.common.world.features.WorldGenWasteland; +import biomesoplenty.common.world.features.WorldGenWasteland2; +import biomesoplenty.common.world.features.WorldGenWasteland3; +import biomesoplenty.common.world.features.WorldGenWasteland4; +import biomesoplenty.common.world.features.WorldGenWaterReeds; +import biomesoplenty.common.world.features.WorldGenWaterside; +import biomesoplenty.common.world.features.managers.WorldGenBOPFlowerManager; +import biomesoplenty.common.world.features.managers.WorldGenBOPGrassManager; +import biomesoplenty.common.world.features.nether.WorldGenLakesNether; +import biomesoplenty.common.world.features.nether.WorldGenWaspHive; +import biomesoplenty.common.world.forcedgenerators.LakesForcedGenerator; +import biomesoplenty.common.world.forcedgenerators.MelonForcedGenerator; +import biomesoplenty.common.world.forcedgenerators.PondForcedGenerator; public class WorldGenFieldAssociation { @@ -78,6 +96,8 @@ public class WorldGenFieldAssociation associateFeature("wasteland2PerChunk", new WorldGenWasteland2()); associateFeature("wasteland3PerChunk", new WorldGenWasteland3()); associateFeature("wasteland4PerChunk", new WorldGenWasteland4()); + associateFeature("smolderingGrassPerChunk", new WorldGenBOPTallGrass(BOPBlockHelper.get("grass"), 1)); + associateFeature("netherLavaLakesPerChunk", new WorldGenLakesNether()); //Nether Features associateFeature("waspHivesPerChunk", new WorldGenWaspHive()); @@ -85,6 +105,7 @@ public class WorldGenFieldAssociation associateFeature("bopFlowersPerChunk", new WorldGenBOPFlowerManager()); associateFeature("bopGrassPerChunk", new WorldGenBOPGrassManager()); } + private static void associateFeaturesForced() { associateFeatureForced("waterPoolsPerChunk", new WorldGenLiquids(Blocks.flowing_water), PondForcedGenerator.class);