From 4c41f69729ef7865310e280cc682f73ea5491ad3 Mon Sep 17 00:00:00 2001 From: Matt Caughey Date: Sat, 18 May 2013 11:28:50 -0400 Subject: [PATCH] Started adding decoration to the Undergarden. --- .../biomes/BiomeDecoratorBOP.java | 13 + .../biomes/BiomeGenNetherGarden.java | 15 + ...hroom.java => WorldGenNetherMushroom.java} | 10 +- .../worldgen/WorldGenNetherVines.java | 263 ++++++++++++++++++ 4 files changed, 296 insertions(+), 5 deletions(-) rename src/minecraft/biomesoplenty/worldgen/{WorldGenBOPBigMushroom.java => WorldGenNetherMushroom.java} (95%) create mode 100644 src/minecraft/biomesoplenty/worldgen/WorldGenNetherVines.java diff --git a/src/minecraft/biomesoplenty/biomes/BiomeDecoratorBOP.java b/src/minecraft/biomesoplenty/biomes/BiomeDecoratorBOP.java index 135f3b785..21c515043 100644 --- a/src/minecraft/biomesoplenty/biomes/BiomeDecoratorBOP.java +++ b/src/minecraft/biomesoplenty/biomes/BiomeDecoratorBOP.java @@ -46,6 +46,7 @@ import biomesoplenty.worldgen.WorldGenMelon; import biomesoplenty.worldgen.WorldGenMesa; import biomesoplenty.worldgen.WorldGenMud; import biomesoplenty.worldgen.WorldGenMycelium; +import biomesoplenty.worldgen.WorldGenNetherVines; import biomesoplenty.worldgen.WorldGenOasis; import biomesoplenty.worldgen.WorldGenOutback; import biomesoplenty.worldgen.WorldGenPit; @@ -186,6 +187,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator protected WorldGenerator holyTallGrassGen; protected WorldGenerator desertSproutsGen; protected WorldGenerator promisedWillowGen; + protected WorldGenerator netherVineGen; protected WorldGenerator quicksandGen; protected WorldGenerator quicksand2Gen; protected WorldGenerator poisonIvyGen; @@ -263,6 +265,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator protected int holyTallGrassPerChunk; protected int desertSproutsPerChunk; protected int promisedWillowPerChunk; + protected int netherVinesPerChunk; protected int quicksandPerChunk; protected int quicksand2PerChunk; protected int poisonIvyPerChunk; @@ -405,6 +408,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator this.poisonIvyGen = new WorldGenBush(Blocks.foliage.get().blockID, 7); this.sunflowerGen = new WorldGenSunflower(Blocks.flowers.get().blockID, 13); this.promisedWillowGen = new WorldGenPromisedWillow(); + this.netherVineGen = new WorldGenNetherVines(); this.quicksandGen = new WorldGenQuicksand(); this.quicksand2Gen = new WorldGenQuicksand2(); this.cattailGen = new WorldGenCattail(); @@ -490,6 +494,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator this.canyonGrassPerChunk = 0; this.steppePerChunk = 0; this.promisedWillowPerChunk = 0; + this.netherVinesPerChunk = 0; this.algaePerChunk = 0; this.pondsPerChunk = 0; this.waterLakesPerChunk = 0; @@ -820,6 +825,14 @@ public class BiomeDecoratorBOP extends BiomeDecorator var5 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; this.promisedWillowGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var5); } + + for (var2 = 0; var2 < this.netherVinesPerChunk; ++var2) + { + var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var4 = this.randomGenerator.nextInt(128); + var5 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.netherVineGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var5); + } for (var2 = 0; var2 < this.whiteFlowersPerChunk; ++var2) { diff --git a/src/minecraft/biomesoplenty/biomes/BiomeGenNetherGarden.java b/src/minecraft/biomesoplenty/biomes/BiomeGenNetherGarden.java index 240fb0d32..076ef5717 100644 --- a/src/minecraft/biomesoplenty/biomes/BiomeGenNetherGarden.java +++ b/src/minecraft/biomesoplenty/biomes/BiomeGenNetherGarden.java @@ -1,9 +1,13 @@ package biomesoplenty.biomes; +import java.util.Random; + import biomesoplenty.configuration.BOPConfiguration; +import biomesoplenty.worldgen.WorldGenNetherMushroom; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.SpawnListEntry; +import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.monster.EntityMagmaCube; import net.minecraft.entity.monster.EntityPigZombie; @@ -17,6 +21,9 @@ public class BiomeGenNetherGarden extends BiomeGenBase super(par1); this.theBiomeDecorator = new BiomeDecoratorBOP(this); this.customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; + this.customBiomeDecorator.treesPerChunk = 3; + this.customBiomeDecorator.netherVinesPerChunk = 40; + this.customBiomeDecorator.mushroomsPerChunk = 20; this.spawnableMonsterList.clear(); this.spawnableCreatureList.clear(); this.spawnableWaterCreatureList.clear(); @@ -25,4 +32,12 @@ public class BiomeGenNetherGarden extends BiomeGenBase this.spawnableMonsterList.add(new SpawnListEntry(EntityPigZombie.class, 100, 4, 4)); this.spawnableMonsterList.add(new SpawnListEntry(EntityMagmaCube.class, 1, 4, 4)); } + + /** + * Gets a WorldGen appropriate for this biome. + */ + public WorldGenerator getRandomWorldGenForTrees(Random par1Random) + { + return new WorldGenNetherMushroom(); + } } diff --git a/src/minecraft/biomesoplenty/worldgen/WorldGenBOPBigMushroom.java b/src/minecraft/biomesoplenty/worldgen/WorldGenNetherMushroom.java similarity index 95% rename from src/minecraft/biomesoplenty/worldgen/WorldGenBOPBigMushroom.java rename to src/minecraft/biomesoplenty/worldgen/WorldGenNetherMushroom.java index fcae040ff..dc6bb142a 100644 --- a/src/minecraft/biomesoplenty/worldgen/WorldGenBOPBigMushroom.java +++ b/src/minecraft/biomesoplenty/worldgen/WorldGenNetherMushroom.java @@ -9,25 +9,25 @@ import net.minecraft.block.Block; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; -public class WorldGenBOPBigMushroom extends WorldGenerator +public class WorldGenNetherMushroom extends WorldGenerator { /** The mushroom type. 0 for brown, 1 for red. */ private int mushroomType = 1; - public WorldGenBOPBigMushroom(int par1) + public WorldGenNetherMushroom(int par1) { super(true); this.mushroomType = par1; } - public WorldGenBOPBigMushroom() + public WorldGenNetherMushroom() { super(false); } public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) { - int l = 1; + int l = par2Random.nextInt(2); if (this.mushroomType >= 0) { @@ -84,7 +84,7 @@ public class WorldGenBOPBigMushroom extends WorldGenerator { j1 = par1World.getBlockId(par3, par4 - 1, par5); - if (j1 != Block.dirt.blockID && j1 != Block.grass.blockID && j1 != Block.mycelium.blockID && j1 != Blocks.holyGrass.get().blockID) + if (j1 != Block.netherrack.blockID) { return false; } diff --git a/src/minecraft/biomesoplenty/worldgen/WorldGenNetherVines.java b/src/minecraft/biomesoplenty/worldgen/WorldGenNetherVines.java new file mode 100644 index 000000000..2e408d56a --- /dev/null +++ b/src/minecraft/biomesoplenty/worldgen/WorldGenNetherVines.java @@ -0,0 +1,263 @@ +package biomesoplenty.worldgen; + +import java.util.Random; + +import biomesoplenty.api.Blocks; +import biomesoplenty.configuration.BOPBlocks; + +import net.minecraft.block.Block; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenerator; + +public class WorldGenNetherVines extends WorldGenerator +{ + public boolean generate(World var1, Random var2, int var3, int var4, int var5) + { + while (var1.isAirBlock(var3, var4, var5) && var4 > 2) + { + --var4; + } + + int var6 = var1.getBlockId(var3, var4, var5); + + if (var6 != Block.netherrack.blockID) + { + return false; + } + else + { + for (int var7 = -2; var7 <= 2; ++var7) + { + for (int var8 = -2; var8 <= 2; ++var8) + { + if (var1.isAirBlock(var3 + var7, var4 - 1, var5 + var8) && var1.isAirBlock(var3 + var7, var4 - 2, var5 + var8)) + { + return false; + } + } + } + + if (var1.isAirBlock(var3 - 1, var4, var5)) + { + var1.setBlock(var3 - 1, var4, var5, Block.vine.blockID, 8, 2); + } + if (var1.isAirBlock(var3 - 1, var4 - 1, var5)) + { + var1.setBlock(var3 - 1, var4 - 1, var5, Block.vine.blockID, 8, 2); + } + if (var1.isAirBlock(var3 - 1, var4 - 2, var5)) + { + var1.setBlock(var3 - 1, var4 - 2, var5, Block.vine.blockID, 8, 2); + } + if (var1.isAirBlock(var3 - 1, var4 - 3, var5)) + { + var1.setBlock(var3 - 1, var4 - 3, var5, Block.vine.blockID, 8, 2); + } + if (var1.isAirBlock(var3 - 1, var4 - 4, var5)) + { + var1.setBlock(var3 - 1, var4 - 4, var5, Block.vine.blockID, 8, 2); + } + if (var1.isAirBlock(var3 - 1, var4 - 5, var5)) + { + var1.setBlock(var3 - 1, var4 - 5, var5, Block.vine.blockID, 8, 2); + } + + if (var1.isAirBlock(var3 + 1, var4, var5)) + { + var1.setBlock(var3 + 1, var4, var5, Block.vine.blockID, 2, 2); + } + if (var1.isAirBlock(var3 + 1, var4 - 1, var5)) + { + var1.setBlock(var3 + 1, var4 - 1, var5, Block.vine.blockID, 2, 2); + } + if (var1.isAirBlock(var3 + 1, var4 - 2, var5)) + { + var1.setBlock(var3 + 1, var4 - 2, var5, Block.vine.blockID, 2, 2); + } + if (var1.isAirBlock(var3 + 1, var4 - 3, var5)) + { + var1.setBlock(var3 + 1, var4 - 3, var5, Block.vine.blockID, 2, 2); + } + if (var1.isAirBlock(var3 + 1, var4 - 4, var5)) + { + var1.setBlock(var3 + 1, var4 - 4, var5, Block.vine.blockID, 2, 2); + } + if (var1.isAirBlock(var3 + 1, var4 - 5, var5)) + { + var1.setBlock(var3 + 1, var4 - 5, var5, Block.vine.blockID, 2, 2); + } + if (var1.isAirBlock(var3 + 1, var4 - 6, var5)) + { + var1.setBlock(var3 + 1, var4 - 6, var5, Block.vine.blockID, 2, 2); + } + if (var1.isAirBlock(var3 + 1, var4 - 7, var5)) + { + var1.setBlock(var3 + 1, var4 - 7, var5, Block.vine.blockID, 2, 2); + } + if (var1.isAirBlock(var3 + 1, var4 - 8, var5)) + { + var1.setBlock(var3 + 1, var4 - 8, var5, Block.vine.blockID, 2, 2); + } + if (var1.isAirBlock(var3 + 1, var4 - 9, var5)) + { + var1.setBlock(var3 + 1, var4 - 9, var5, Block.vine.blockID, 2, 2); + } + if (var1.isAirBlock(var3 + 1, var4 - 10, var5)) + { + var1.setBlock(var3 + 1, var4 - 10, var5, Block.vine.blockID, 2, 2); + } + + if (var1.isAirBlock(var3, var4, var5 - 1)) + { + var1.setBlock(var3, var4, var5 - 1, Block.vine.blockID, 1, 2); + } + if (var1.isAirBlock(var3, var4 - 1, var5 - 1)) + { + var1.setBlock(var3, var4 - 1, var5 - 1, Block.vine.blockID, 1, 2); + } + if (var1.isAirBlock(var3, var4 - 2, var5 - 1)) + { + var1.setBlock(var3, var4 - 2, var5 - 1, Block.vine.blockID, 1, 2); + } + if (var1.isAirBlock(var3, var4 - 3, var5 - 1)) + { + var1.setBlock(var3, var4 - 3, var5 - 1, Block.vine.blockID, 1, 2); + } + if (var1.isAirBlock(var3, var4 - 4, var5 - 1)) + { + var1.setBlock(var3, var4 - 4, var5 - 1, Block.vine.blockID, 1, 2); + } + if (var1.isAirBlock(var3, var4 - 5, var5 - 1)) + { + var1.setBlock(var3, var4 - 5, var5 - 1, Block.vine.blockID, 1, 2); + } + if (var1.isAirBlock(var3, var4 - 6, var5 - 1)) + { + var1.setBlock(var3, var4 - 6, var5 - 1, Block.vine.blockID, 1, 2); + } + if (var1.isAirBlock(var3, var4 - 7, var5 - 1)) + { + var1.setBlock(var3, var4 - 7, var5 - 1, Block.vine.blockID, 1, 2); + } + if (var1.isAirBlock(var3, var4 - 8, var5 - 1)) + { + var1.setBlock(var3, var4 - 8, var5 - 1, Block.vine.blockID, 1, 2); + } + if (var1.isAirBlock(var3, var4 - 9, var5 - 1)) + { + var1.setBlock(var3, var4 - 9, var5 - 1, Block.vine.blockID, 1, 2); + } + if (var1.isAirBlock(var3, var4 - 10, var5 - 1)) + { + var1.setBlock(var3, var4 - 10, var5 - 1, Block.vine.blockID, 1, 2); + } + if (var1.isAirBlock(var3, var4 - 11, var5 - 1)) + { + var1.setBlock(var3, var4 - 11, var5 - 1, Block.vine.blockID, 1, 2); + } + if (var1.isAirBlock(var3, var4 - 12, var5 - 1)) + { + var1.setBlock(var3, var4 - 12, var5 - 1, Block.vine.blockID, 1, 2); + } + if (var1.isAirBlock(var3, var4 - 13, var5 - 1)) + { + var1.setBlock(var3, var4 - 13, var5 - 1, Block.vine.blockID, 1, 2); + } + if (var1.isAirBlock(var3, var4 - 14, var5 - 1)) + { + var1.setBlock(var3, var4 - 14, var5 - 1, Block.vine.blockID, 1, 2); + } + if (var1.isAirBlock(var3, var4 - 15, var5 - 1)) + { + var1.setBlock(var3, var4 - 15, var5 - 1, Block.vine.blockID, 1, 2); + } + + if (var1.isAirBlock(var3, var4, var5 + 1)) + { + var1.setBlock(var3, var4, var5 + 1, Block.vine.blockID, 4, 2); + } + if (var1.isAirBlock(var3, var4 - 1, var5 + 1)) + { + var1.setBlock(var3, var4 - 1, var5 + 1, Block.vine.blockID, 4, 2); + } + if (var1.isAirBlock(var3, var4 - 2, var5 + 1)) + { + var1.setBlock(var3, var4 - 2, var5 + 1, Block.vine.blockID, 4, 2); + } + if (var1.isAirBlock(var3, var4 - 3, var5 + 1)) + { + var1.setBlock(var3, var4 - 3, var5 + 1, Block.vine.blockID, 4, 2); + } + if (var1.isAirBlock(var3, var4 - 4, var5 + 1)) + { + var1.setBlock(var3, var4 - 4, var5 + 1, Block.vine.blockID, 4, 2); + } + if (var1.isAirBlock(var3, var4 - 5, var5 + 1)) + { + var1.setBlock(var3, var4 - 5, var5 + 1, Block.vine.blockID, 4, 2); + } + if (var1.isAirBlock(var3, var4 - 6, var5 + 1)) + { + var1.setBlock(var3, var4 - 6, var5 + 1, Block.vine.blockID, 4, 2); + } + if (var1.isAirBlock(var3, var4 - 7, var5 + 1)) + { + var1.setBlock(var3, var4 - 7, var5 + 1, Block.vine.blockID, 4, 2); + } + if (var1.isAirBlock(var3, var4 - 8, var5 + 1)) + { + var1.setBlock(var3, var4 - 8, var5 + 1, Block.vine.blockID, 4, 2); + } + if (var1.isAirBlock(var3, var4 - 9, var5 + 1)) + { + var1.setBlock(var3, var4 - 9, var5 + 1, Block.vine.blockID, 4, 2); + } + if (var1.isAirBlock(var3, var4 - 10, var5 + 1)) + { + var1.setBlock(var3, var4 - 10, var5 + 1, Block.vine.blockID, 4, 2); + } + if (var1.isAirBlock(var3, var4 - 11, var5 + 1)) + { + var1.setBlock(var3, var4 - 11, var5 + 1, Block.vine.blockID, 4, 2); + } + if (var1.isAirBlock(var3, var4 - 12, var5 + 1)) + { + var1.setBlock(var3, var4 - 12, var5 + 1, Block.vine.blockID, 4, 2); + } + if (var1.isAirBlock(var3, var4 - 13, var5 + 1)) + { + var1.setBlock(var3, var4 - 13, var5 + 1, Block.vine.blockID, 4, 2); + } + if (var1.isAirBlock(var3, var4 - 14, var5 + 1)) + { + var1.setBlock(var3, var4 - 14, var5 + 1, Block.vine.blockID, 4, 2); + } + if (var1.isAirBlock(var3, var4 - 15, var5 + 1)) + { + var1.setBlock(var3, var4 - 15, var5 + 1, Block.vine.blockID, 4, 2); + } + if (var1.isAirBlock(var3, var4 - 16, var5 + 1)) + { + var1.setBlock(var3, var4 - 16, var5 + 1, Block.vine.blockID, 4, 2); + } + if (var1.isAirBlock(var3, var4 - 17, var5 + 1)) + { + var1.setBlock(var3, var4 - 17, var5 + 1, Block.vine.blockID, 4, 2); + } + if (var1.isAirBlock(var3, var4 - 18, var5 + 1)) + { + var1.setBlock(var3, var4 - 18, var5 + 1, Block.vine.blockID, 4, 2); + } + if (var1.isAirBlock(var3, var4 - 19, var5 + 1)) + { + var1.setBlock(var3, var4 - 19, var5 + 1, Block.vine.blockID, 4, 2); + } + if (var1.isAirBlock(var3, var4 - 20, var5 + 1)) + { + var1.setBlock(var3, var4 - 20, var5 + 1, Block.vine.blockID, 4, 2); + } + + return true; + } + } +}