From 5d172e501d60d5c355ad4e66e6f3d11a243d1774 Mon Sep 17 00:00:00 2001 From: Matt Caughey Date: Fri, 27 Mar 2015 19:01:08 -0400 Subject: [PATCH] Revamped the Fungi Forest biome --- .../biome/overworld/BiomeGenFungiForest.java | 53 +++--- .../biomesoplenty/common/core/BOPBiomes.java | 2 +- .../common/world/features/WorldGenIvy.java | 57 +++++++ .../features/trees/WorldGenBOPJungle.java | 157 ++++++++++++++++++ 4 files changed, 247 insertions(+), 22 deletions(-) create mode 100644 src/main/java/biomesoplenty/common/world/features/WorldGenIvy.java create mode 100644 src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPJungle.java diff --git a/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenFungiForest.java b/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenFungiForest.java index 8c028acba..67d2c393b 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenFungiForest.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenFungiForest.java @@ -6,22 +6,21 @@ import net.minecraft.block.Block; import net.minecraft.entity.passive.EntityMooshroom; import net.minecraft.init.Blocks; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase.Height; -import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry; import net.minecraft.world.gen.feature.WorldGenAbstractTree; import net.minecraft.world.gen.feature.WorldGenShrub; import biomesoplenty.api.content.BOPCBlocks; +import biomesoplenty.client.fog.IBiomeFog; import biomesoplenty.common.biome.BOPOverworldBiome; import biomesoplenty.common.configuration.BOPConfigurationMisc; import biomesoplenty.common.world.features.WorldGenBOPDoubleFlora; import biomesoplenty.common.world.features.WorldGenBOPFlora; import biomesoplenty.common.world.features.WorldGenBOPTallGrass; -import biomesoplenty.common.world.features.WorldGenMoss; -import biomesoplenty.common.world.features.trees.WorldGenBOPTaiga3; +import biomesoplenty.common.world.features.WorldGenIvy; +import biomesoplenty.common.world.features.trees.WorldGenBOPJungle; -public class BiomeGenFungiForest extends BOPOverworldBiome +public class BiomeGenFungiForest extends BOPOverworldBiome implements IBiomeFog { - private static final Height biomeHeight = new Height(0.2F, 0.5F); + private static final Height biomeHeight = new Height(0.1F, 0.2F); public BiomeGenFungiForest(int biomeID) { @@ -37,14 +36,16 @@ public class BiomeGenFungiForest extends BOPOverworldBiome this.waterColorMultiplier = 65326; - this.theBiomeDecorator.treesPerChunk = 8; + this.theBiomeDecorator.treesPerChunk = 12; this.theBiomeDecorator.mushroomsPerChunk = 8; - this.theBiomeDecorator.bigMushroomsPerChunk = 8; + this.theBiomeDecorator.bigMushroomsPerChunk = 9; this.theBiomeDecorator.waterlilyPerChunk = 4; + this.theBiomeDecorator.sandPerChunk = -999; + this.theBiomeDecorator.sandPerChunk2 = -999; this.theBiomeDecorator.bopFeatures.bopLilyPerChunk = 4; - this.theBiomeDecorator.bopFeatures.sproutsPerChunk = 2; - this.theBiomeDecorator.bopFeatures.bushesPerChunk = 1; + this.theBiomeDecorator.bopFeatures.sproutsPerChunk = 4; + this.theBiomeDecorator.bopFeatures.bushesPerChunk = 7; this.theBiomeDecorator.bopFeatures.toadstoolsPerChunk = 5; this.theBiomeDecorator.bopFeatures.portobellosPerChunk = 7; this.theBiomeDecorator.bopFeatures.blueMilksPerChunk = 2; @@ -54,7 +55,7 @@ public class BiomeGenFungiForest extends BOPOverworldBiome this.theBiomeDecorator.bopFeatures.cloverPatchesPerChunk = 20; this.theBiomeDecorator.bopFeatures.generateMycelium = true; - this.theBiomeDecorator.bopFeatures.bopGrassPerChunk = 12; + this.theBiomeDecorator.bopFeatures.bopGrassPerChunk = 25; this.theBiomeDecorator.bopFeatures.bopFlowersPerChunk = 3; this.theBiomeDecorator.bopFeatures.weightedFlowerGen.put(new WorldGenBOPFlora(BOPCBlocks.flowers, 1), 8); @@ -87,13 +88,13 @@ public class BiomeGenFungiForest extends BOPOverworldBiome } } - for (int i = 0; i < 20; i++) + for (int i = 0; i < 50; i++) { int x = chunkX + random.nextInt(16) + 8; - short y = 58; + short y = 128; int z = chunkZ + random.nextInt(16) + 8; - new WorldGenMoss().generate(world, random, x, y, z); + new WorldGenIvy().generate(world, random, x, y, z); } } @@ -101,28 +102,38 @@ public class BiomeGenFungiForest extends BOPOverworldBiome //TODO: getRandomWorldGenForTrees() public WorldGenAbstractTree func_150567_a(Random random) { - return random.nextInt(3) == 0 ? new WorldGenBOPTaiga3(Blocks.log, BOPCBlocks.leaves2, 0, 3, false, 25, 10, 1) : - ((random.nextInt(5) == 0 ? new WorldGenBOPTaiga3(Blocks.log, BOPCBlocks.leaves1, 0, 0, false, 15, 15, 2) : - (random.nextInt(2) == 0 ? new WorldGenShrub(0, 0) : - new WorldGenBOPTaiga3(Blocks.log, Blocks.leaves, 0, 0, false, 35, 10, 0)))); + return random.nextInt(2) == 0 ? new WorldGenBOPJungle(false, 5, 20, 0, 0) : new WorldGenShrub(0, 0); } @Override public int getBiomeGrassColor(int x, int y, int z) { - return 15792496; + return 5762404; } @Override public int getBiomeFoliageColor(int x, int y, int z) { - return 11139946; + return 5762404; } @Override public int getSkyColorByTemp(float par1) { - if (BOPConfigurationMisc.skyColors) return 11513806; + if (BOPConfigurationMisc.skyColors) return 7587486; else return super.getSkyColorByTemp(par1); } + + @Override + public int getFogColour(int x, int y, int z) + { + return 8043468; + } + + @Override + public float getFogDensity(int x, int y, int z) + { + // TODO Auto-generated method stub + return 0.6F; + } } diff --git a/src/main/java/biomesoplenty/common/core/BOPBiomes.java b/src/main/java/biomesoplenty/common/core/BOPBiomes.java index 9e58df87d..7fdf92455 100644 --- a/src/main/java/biomesoplenty/common/core/BOPBiomes.java +++ b/src/main/java/biomesoplenty/common/core/BOPBiomes.java @@ -262,7 +262,7 @@ public class BOPBiomes fen = registerOverworldBiome(BiomeGenFen.class, "Fen", TemperatureType.COOL, 10); flowerField = registerOverworldBiome(BiomeGenFlowerField.class, "Flower Field", TemperatureType.WARM, 3); frostForest = registerOverworldBiome(BiomeGenFrostForest.class, "Frost Forest", TemperatureType.ICY, 7); - fungiForest = registerOverworldBiome(BiomeGenFungiForest.class, "Fungi Forest", TemperatureType.COOL, 3); + onlyBiome = fungiForest = registerOverworldBiome(BiomeGenFungiForest.class, "Fungi Forest", TemperatureType.COOL, 3); garden = registerOverworldBiome(BiomeGenGarden.class, "Garden", TemperatureType.COOL, 3); grassland = registerOverworldBiome(BiomeGenGrassland.class, "Grassland", TemperatureType.COOL, 10); grove = registerOverworldBiome(BiomeGenGrove.class, "Grove", TemperatureType.COOL, 7); diff --git a/src/main/java/biomesoplenty/common/world/features/WorldGenIvy.java b/src/main/java/biomesoplenty/common/world/features/WorldGenIvy.java new file mode 100644 index 000000000..3fc208c61 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenIvy.java @@ -0,0 +1,57 @@ +package biomesoplenty.common.world.features; + +import java.util.Random; + +import net.minecraft.util.Direction; +import net.minecraft.util.Facing; +import net.minecraft.world.World; +import biomesoplenty.api.biome.BOPBiome; +import biomesoplenty.api.content.BOPCBlocks; +import biomesoplenty.common.world.generation.WorldGeneratorBOP; + +public class WorldGenIvy extends WorldGeneratorBOP +{ + @Override + public boolean generate(World world, Random random, int x, int y, int z) + { + int var6 = x; + + for (int var7 = z; y < 128; ++y) + { + //TODO: isAirBlock() + if (world.isAirBlock(x, y, z)) + { + for (int var8 = 2; var8 <= 5; ++var8) + { + //TODO: canPlaceBlockOnSide() + if (BOPCBlocks.ivy.canPlaceBlockOnSide(world, x, y, z, var8)) + { + //TODO: setBlock() + world.setBlock(x, y, z, BOPCBlocks.ivy, 1 << Direction.facingToDirection[Facing.oppositeSide[var8]], 2); + break; + } + } + } + else + { + x = var6 + random.nextInt(4) - random.nextInt(4); + z = var7 + random.nextInt(4) - random.nextInt(4); + } + } + + return true; + } + + @Override + public void setupGeneration(World world, Random random, BOPBiome biome, String featureName, int x, int z) + { + for (int i = 0; i < (Integer)biome.theBiomeDecorator.bopFeatures.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); + } + } +} diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPJungle.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPJungle.java new file mode 100644 index 000000000..e6df72fd1 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPJungle.java @@ -0,0 +1,157 @@ +package biomesoplenty.common.world.features.trees; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenHugeTrees; +import biomesoplenty.api.content.BOPCBlocks; + +public class WorldGenBOPJungle extends WorldGenHugeTrees +{ + private static final String __OBFID = "CL_00000420"; + + public WorldGenBOPJungle(boolean p_i45456_1_, int p_i45456_2_, int p_i45456_3_, int p_i45456_4_, int p_i45456_5_) + { + super(p_i45456_1_, p_i45456_2_, p_i45456_3_, p_i45456_4_, p_i45456_5_); + } + + public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_) + { + int l = this.func_150533_a(p_76484_2_); + + if (!this.func_150537_a(p_76484_1_, p_76484_2_, p_76484_3_, p_76484_4_, p_76484_5_, l)) + { + return false; + } + else + { + this.func_150543_c(p_76484_1_, p_76484_3_, p_76484_5_, p_76484_4_ + l, 2, p_76484_2_); + + for (int i1 = p_76484_4_ + 2; i1 < p_76484_4_ + l; i1 += p_76484_2_.nextInt(4)) + { + float f = p_76484_2_.nextFloat() * (float)Math.PI * 2.0F; + int j1 = p_76484_3_ + (int)(0.5F + MathHelper.cos(f) * 4.0F); + int k1 = p_76484_5_ + (int)(0.5F + MathHelper.sin(f) * 4.0F); + int l1; + + for (l1 = 0; l1 < 5; ++l1) + { + j1 = p_76484_3_ + (int)(1.5F + MathHelper.cos(f) * (float)l1); + k1 = p_76484_5_ + (int)(1.5F + MathHelper.sin(f) * (float)l1); + this.setBlockAndNotifyAdequately(p_76484_1_, j1, i1 - 3 + l1 / 2, k1, Blocks.log, this.woodMetadata); + } + + l1 = 1 + p_76484_2_.nextInt(2); + int i2 = i1; + + for (int j2 = i1 - l1; j2 <= i2; ++j2) + { + int k2 = j2 - i2; + this.func_150534_b(p_76484_1_, j1, j2, k1, 1 - k2, p_76484_2_); + } + } + + for (int l2 = 0; l2 < l; ++l2) + { + Block block = p_76484_1_.getBlock(p_76484_3_, p_76484_4_ + l2, p_76484_5_); + + if (block.isAir(p_76484_1_, p_76484_3_, p_76484_4_ + l2, p_76484_5_) || block.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_ + l2, p_76484_5_)) + { + this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_, p_76484_4_ + l2, p_76484_5_, Blocks.log, this.woodMetadata); + + if (l2 > 0) + { + if (p_76484_2_.nextInt(3) > 0 && p_76484_1_.isAirBlock(p_76484_3_ - 1, p_76484_4_ + l2, p_76484_5_)) + { + this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_ - 1, p_76484_4_ + l2, p_76484_5_, BOPCBlocks.ivy, 8); + } + + if (p_76484_2_.nextInt(3) > 0 && p_76484_1_.isAirBlock(p_76484_3_, p_76484_4_ + l2, p_76484_5_ - 1)) + { + this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_, p_76484_4_ + l2, p_76484_5_ - 1, BOPCBlocks.ivy, 1); + } + } + } + + if (l2 < l - 1) + { + block = p_76484_1_.getBlock(p_76484_3_ + 1, p_76484_4_ + l2, p_76484_5_); + + if (block.isAir(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + l2, p_76484_5_) || block.isLeaves(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + l2, p_76484_5_)) + { + this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + l2, p_76484_5_, Blocks.log, this.woodMetadata); + + if (l2 > 0) + { + if (p_76484_2_.nextInt(3) > 0 && p_76484_1_.isAirBlock(p_76484_3_ + 2, p_76484_4_ + l2, p_76484_5_)) + { + this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_ + 2, p_76484_4_ + l2, p_76484_5_, BOPCBlocks.ivy, 2); + } + + if (p_76484_2_.nextInt(3) > 0 && p_76484_1_.isAirBlock(p_76484_3_ + 1, p_76484_4_ + l2, p_76484_5_ - 1)) + { + this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + l2, p_76484_5_ - 1, BOPCBlocks.ivy, 1); + } + } + } + + block = p_76484_1_.getBlock(p_76484_3_ + 1, p_76484_4_ + l2, p_76484_5_ + 1); + + if (block.isAir(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + l2, p_76484_5_ + 1) || block.isLeaves(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + l2, p_76484_5_ + 1)) + { + this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + l2, p_76484_5_ + 1, Blocks.log, this.woodMetadata); + + if (l2 > 0) + { + if (p_76484_2_.nextInt(3) > 0 && p_76484_1_.isAirBlock(p_76484_3_ + 2, p_76484_4_ + l2, p_76484_5_ + 1)) + { + this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_ + 2, p_76484_4_ + l2, p_76484_5_ + 1, BOPCBlocks.ivy, 2); + } + + if (p_76484_2_.nextInt(3) > 0 && p_76484_1_.isAirBlock(p_76484_3_ + 1, p_76484_4_ + l2, p_76484_5_ + 2)) + { + this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + l2, p_76484_5_ + 2, BOPCBlocks.ivy, 4); + } + } + } + + block = p_76484_1_.getBlock(p_76484_3_, p_76484_4_ + l2, p_76484_5_ + 1); + + if (block.isAir(p_76484_1_, p_76484_3_, p_76484_4_ + l2, p_76484_5_ + 1) || block.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_ + l2, p_76484_5_ + 1)) + { + this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_, p_76484_4_ + l2, p_76484_5_ + 1, Blocks.log, this.woodMetadata); + + if (l2 > 0) + { + if (p_76484_2_.nextInt(3) > 0 && p_76484_1_.isAirBlock(p_76484_3_ - 1, p_76484_4_ + l2, p_76484_5_ + 1)) + { + this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_ - 1, p_76484_4_ + l2, p_76484_5_ + 1, BOPCBlocks.ivy, 8); + } + + if (p_76484_2_.nextInt(3) > 0 && p_76484_1_.isAirBlock(p_76484_3_, p_76484_4_ + l2, p_76484_5_ + 2)) + { + this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_, p_76484_4_ + l2, p_76484_5_ + 2, BOPCBlocks.ivy, 4); + } + } + } + } + } + + return true; + } + } + + private void func_150543_c(World p_150543_1_, int p_150543_2_, int p_150543_3_, int p_150543_4_, int p_150543_5_, Random p_150543_6_) + { + byte b0 = 2; + + for (int i1 = p_150543_4_ - b0; i1 <= p_150543_4_; ++i1) + { + int j1 = i1 - p_150543_4_; + this.func_150535_a(p_150543_1_, p_150543_2_, i1, p_150543_3_, p_150543_5_ + 1 - j1, p_150543_6_); + } + } +} \ No newline at end of file