From b2657ce34432ead6621707e71bed6cae4cb00c1a Mon Sep 17 00:00:00 2001 From: Forstride Date: Fri, 5 Feb 2016 21:32:31 -0500 Subject: [PATCH] Tweaked Xeric Shrubland biome --- .../biome/overworld/BiomeGenBrushland.java | 2 +- .../overworld/BiomeGenXericShrubland.java | 69 +++++++++++++------ 2 files changed, 50 insertions(+), 21 deletions(-) diff --git a/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenBrushland.java b/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenBrushland.java index 973ad0ba1..0e87c49e8 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenBrushland.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenBrushland.java @@ -55,7 +55,7 @@ public class BiomeGenBrushland extends BOPBiome GeneratorWeighted treeGenerator = new GeneratorWeighted(6.0F); this.addGenerator("trees", GeneratorStage.TREE, treeGenerator); treeGenerator.add("brush", 1, (new GeneratorBasicTree.Builder()).log(BlockPlanks.EnumType.JUNGLE).leaves(BlockPlanks.EnumType.OAK).minHeight(3).maxHeight(5).leafLayers(2).create()); - treeGenerator.add("brush_twiglet", 2, (new GeneratorTwigletTree.Builder()).minHeight(2).maxHeight(2).log(BlockPlanks.EnumType.JUNGLE).leaves(BlockPlanks.EnumType.OAK).create()); + treeGenerator.add("brush_twiglet", 2, (new GeneratorTwigletTree.Builder()).minHeight(1).maxHeight(2).log(BlockPlanks.EnumType.JUNGLE).leaves(BlockPlanks.EnumType.OAK).create()); treeGenerator.add("brush_bush", 3, (new GeneratorFlora.Builder()).placeOn(this.topBlock).replace(Material.air).withNonDecayingLeaf(BlockPlanks.EnumType.OAK).generationAttempts(8).create()); treeGenerator.add("decaying_tree", 2, (new GeneratorBigTree.Builder()).amountPerChunk(1.0F).log(BlockPlanks.EnumType.ACACIA).leaves(BlockPlanks.EnumType.ACACIA).minHeight(4).maxHeight(10).foliageHeight(1).create()); diff --git a/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenXericShrubland.java b/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenXericShrubland.java index e18b94e45..8fac2f3a5 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenXericShrubland.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenXericShrubland.java @@ -8,10 +8,17 @@ package biomesoplenty.common.biome.overworld; +import java.util.Random; + import net.minecraft.block.BlockFlower; +import net.minecraft.block.BlockPlanks; import net.minecraft.block.BlockTallGrass; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.chunk.ChunkPrimer; import biomesoplenty.api.biome.BOPBiome; import biomesoplenty.api.biome.generation.GeneratorStage; import biomesoplenty.api.biome.generation.GeneratorWeighted; @@ -23,73 +30,88 @@ import biomesoplenty.common.enums.BOPGems; import biomesoplenty.common.enums.BOPPlants; import biomesoplenty.common.util.block.BlockQuery; import biomesoplenty.common.util.block.BlockQuery.IBlockPosQuery; +import biomesoplenty.common.util.config.BOPConfig.IConfigObj; import biomesoplenty.common.world.BOPWorldSettings; import biomesoplenty.common.world.feature.GeneratorColumns; import biomesoplenty.common.world.feature.GeneratorFlora; import biomesoplenty.common.world.feature.GeneratorGrass; import biomesoplenty.common.world.feature.GeneratorOreSingle; import biomesoplenty.common.world.feature.GeneratorSplatter; +import biomesoplenty.common.world.feature.tree.GeneratorBasicTree; +import biomesoplenty.common.world.feature.tree.GeneratorBigTree; +import biomesoplenty.common.world.feature.tree.GeneratorBush; +import biomesoplenty.common.world.feature.tree.GeneratorTwigletTree; public class BiomeGenXericShrubland extends BOPBiome { + public IBlockState usualTopBlock; + public IBlockState alternateTopBlock; + public BiomeGenXericShrubland() { // terrain - this.terrainSettings.avgHeight(64).heightVariation(4, 15); + this.terrainSettings.avgHeight(64).heightVariation(1, 5); this.setColor(0xE2CDA5); this.setTemperatureRainfall(1.1F, 0.1F); this.topBlock = Blocks.sand.getDefaultState(); this.fillerBlock = Blocks.sand.getDefaultState(); + this.usualTopBlock = this.topBlock; + this.alternateTopBlock = BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.SANDY); this.canSpawnInBiome = false; this.canGenerateVillages = true; - this.addWeight(BOPClimates.HOT_DESERT, 1); + this.addWeight(BOPClimates.SAVANNA, 1); this.spawnableCreatureList.clear(); - // splatter top blocks - IBlockPosQuery emptySand = BlockQuery.buildAnd().withAirAbove().states(this.topBlock).create(); - this.addGenerator("grass_splatter", GeneratorStage.SAND, (new GeneratorSplatter.Builder()).amountPerChunk(5.0F).generationAttempts(128).replace(emptySand).with(BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.SANDY)).create()); + // trees & logs + GeneratorWeighted treeGenerator = new GeneratorWeighted(5.0F); + this.addGenerator("trees", GeneratorStage.TREE, treeGenerator); + treeGenerator.add("brush_twiglet", 1, (new GeneratorTwigletTree.Builder()).placeOn(this.topBlock).minHeight(1).maxHeight(2).log(BlockPlanks.EnumType.ACACIA).leaves(BlockPlanks.EnumType.ACACIA).create()); + treeGenerator.add("brush_bush", 3, (new GeneratorFlora.Builder()).placeOn(this.topBlock).replace(Material.air).withNonDecayingLeaf(BlockPlanks.EnumType.ACACIA).create()); + treeGenerator.add("oak_bush", 2, (new GeneratorBush.Builder()).maxHeight(2).create()); // other plants - this.addGenerator("desertgrass", GeneratorStage.GRASS, (new GeneratorGrass.Builder()).amountPerChunk(0.8F).with(BOPPlants.DESERTGRASS).generationAttempts(8).create()); - this.addGenerator("desert_sprouts", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.5F).with(BOPPlants.DESERTSPROUTS).generationAttempts(8).create()); + this.addGenerator("dunegrass", GeneratorStage.GRASS, (new GeneratorGrass.Builder()).amountPerChunk(6.0F).with(BOPPlants.DUNEGRASS).generationAttempts(8).create()); + this.addGenerator("desertgrass", GeneratorStage.GRASS, (new GeneratorGrass.Builder()).amountPerChunk(12.0F).with(BOPPlants.DESERTGRASS).generationAttempts(8).create()); + this.addGenerator("desert_sprouts", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(1.5F).with(BOPPlants.DESERTSPROUTS).generationAttempts(8).create()); this.addGenerator("bromeliad", GeneratorStage.FLOWERS, (new GeneratorFlora.Builder().amountPerChunk(0.5F).with(BOPFlowers.BROMELIAD).generationAttempts(8).create())); - this.addGenerator("leaf_piles", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.75F).with(BOPPlants.LEAFPILE).generationAttempts(32).create()); this.addGenerator("bushes", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.8F).with(BOPPlants.BUSH).create()); this.addGenerator("tiny_cacti", GeneratorStage.FLOWERS, (new GeneratorFlora.Builder()).amountPerChunk(0.9F).with(BOPPlants.TINYCACTUS).create()); this.addGenerator("dead_bushes", GeneratorStage.FLOWERS, (new GeneratorFlora.Builder()).amountPerChunk(1.0F).with(Blocks.deadbush.getDefaultState()).create()); this.addGenerator("cacti", GeneratorStage.FLOWERS,(new GeneratorColumns.Builder()).amountPerChunk(1.5F).generationAttempts(3).placeOn(this.topBlock).with(Blocks.cactus.getDefaultState()).minHeight(1).maxHeight(2).create()); - // flowers - GeneratorWeighted flowerGenerator = new GeneratorWeighted(1.0F); - this.addGenerator("flowers", GeneratorStage.GRASS, flowerGenerator); - flowerGenerator.add("wildflowers", 1, (new GeneratorFlora.Builder().with(BOPFlowers.WILDFLOWER).create())); - // grasses (note weighting must be quite high as the grasses will only grow on the splattered grass blocks) GeneratorWeighted grassGenerator = new GeneratorWeighted(12.0F); this.addGenerator("grass", GeneratorStage.GRASS, grassGenerator); + grassGenerator.add("shortgrass", 7, (new GeneratorGrass.Builder()).with(BOPPlants.SHORTGRASS).create()); grassGenerator.add("mediumgrass", 2, (new GeneratorGrass.Builder()).with(BOPPlants.MEDIUMGRASS).create()); - grassGenerator.add("wheatgrass", 2, (new GeneratorGrass.Builder()).with(BOPPlants.WHEATGRASS).create()); - grassGenerator.add("dampgrass", 2, (new GeneratorGrass.Builder()).with(BOPPlants.DAMPGRASS).create()); grassGenerator.add("tallgrass", 3, (new GeneratorGrass.Builder()).with(BlockTallGrass.EnumType.GRASS).create()); // gem this.addGenerator("ruby", GeneratorStage.SAND, (new GeneratorOreSingle.Builder()).amountPerChunk(12).with(BOPGems.RUBY).create()); } + @Override + public void configure(IConfigObj conf) + { + super.configure(conf); + + this.usualTopBlock = this.topBlock; + this.alternateTopBlock = conf.getBlockState("alternateTopBlock", this.alternateTopBlock); + } + @Override public void applySettings(BOPWorldSettings settings) { if (!settings.generateBopGems) {this.removeGenerator("ruby");} - - IBlockPosQuery emptySand = BlockQuery.buildAnd().withAirAbove().states(this.topBlock).create(); - if (!settings.generateBopSoils) {this.removeGenerator("grass_splatter"); this.addGenerator("grass_splatter_new", GeneratorStage.SAND, (new GeneratorSplatter.Builder()).amountPerChunk(5.0F).generationAttempts(128).replace(emptySand).with(Blocks.grass.getDefaultState()).create());} - + if (!settings.generateBopFoliage) {this.removeGenerator("caveweed"); this.removeGenerator("bushes"); this.removeGenerator("koru"); this.removeGenerator("shrubs"); this.removeGenerator("leaf_piles"); this.removeGenerator("dead_leaf_piles"); this.removeGenerator("clover_patches"); this.removeGenerator("sprouts");} + if (!settings.generateBopSoils) {this.alternateTopBlock = Blocks.grass.getDefaultState();} + if (!settings.generateBopPlants) {this.removeGenerator("cattail"); this.removeGenerator("double_cattail"); this.removeGenerator("river_cane"); this.removeGenerator("tiny_cacti"); this.removeGenerator("roots"); this.removeGenerator("rafflesia"); this.removeGenerator("desert_sprouts");} if (!settings.generateBopWaterPlants) {this.removeGenerator("algae"); this.removeGenerator("water_reeds"); this.removeGenerator("algae"); this.removeGenerator("duckweed"); this.removeGenerator("medium_lily"); this.removeGenerator("small_lily"); this.removeGenerator("tiny_lily");} @@ -97,7 +119,14 @@ public class BiomeGenXericShrubland extends BOPBiome if (!settings.generateBopFlowers) {this.removeGenerator("flowers"); this.removeGenerator("bromeliad");} GeneratorWeighted grassGen = (GeneratorWeighted)this.getGenerator("grass"); - if (!settings.generateBopGrasses) {grassGen.removeGenerator("shortgrass"); grassGen.removeGenerator("mediumgrass"); grassGen.removeGenerator("wheatgrass"); grassGen.removeGenerator("dampgrass"); this.removeGenerator("dune_grass"); this.removeGenerator("desertgrass");} + if (!settings.generateBopGrasses) {grassGen.removeGenerator("shortgrass"); grassGen.removeGenerator("mediumgrass"); grassGen.removeGenerator("wheatgrass"); grassGen.removeGenerator("dampgrass"); this.removeGenerator("dunegrass"); this.removeGenerator("desertgrass");} + } + + @Override + public void genTerrainBlocks(World world, Random rand, ChunkPrimer primer, int x, int z, double noise) + { + this.topBlock = (noise + rand.nextDouble() * 1.0D > 1.8D) ? this.alternateTopBlock : this.usualTopBlock; + super.genTerrainBlocks(world, rand, primer, x, z, noise); } @Override