Allow configuration of normal and alternative top blocks in dense forest

This commit is contained in:
Cheeserolls 2015-05-24 14:54:15 +01:00
parent 7007e8bd92
commit d9cf50efa9

View file

@ -18,6 +18,7 @@ import biomesoplenty.common.block.BlockBOPPlant;
import biomesoplenty.common.block.BlockGem; import biomesoplenty.common.block.BlockGem;
import biomesoplenty.common.enums.BOPGems; import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants; import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.util.config.ConfigHelper;
import biomesoplenty.common.world.feature.GeneratorFlora; import biomesoplenty.common.world.feature.GeneratorFlora;
import biomesoplenty.common.world.feature.GeneratorGrass; import biomesoplenty.common.world.feature.GeneratorGrass;
import biomesoplenty.common.world.feature.GeneratorOreSingle; import biomesoplenty.common.world.feature.GeneratorOreSingle;
@ -25,6 +26,7 @@ import biomesoplenty.common.world.feature.tree.GeneratorBigTree;
import biomesoplenty.common.world.feature.tree.GeneratorBush; import biomesoplenty.common.world.feature.tree.GeneratorBush;
import net.minecraft.block.BlockDirt; import net.minecraft.block.BlockDirt;
import net.minecraft.block.BlockTallGrass; import net.minecraft.block.BlockTallGrass;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -35,6 +37,9 @@ public class BiomeGenDenseForest extends BOPBiome
{ {
private static final Height biomeHeight = new Height(0.075F, 0.05F); private static final Height biomeHeight = new Height(0.075F, 0.05F);
public IBlockState usualTopBlock;
public IBlockState alternateTopBlock;
public BiomeGenDenseForest() public BiomeGenDenseForest()
{ {
this.setHeight(biomeHeight); this.setHeight(biomeHeight);
@ -43,6 +48,11 @@ public class BiomeGenDenseForest extends BOPBiome
this.addWeight(BiomeType.WARM, 7); this.addWeight(BiomeType.WARM, 7);
this.topBlock = Blocks.grass.getDefaultState();
this.fillerBlock = Blocks.dirt.getDefaultState();
this.usualTopBlock = this.topBlock;
this.alternateTopBlock = Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT);
this.addGenerator("bushes", GeneratorStage.FLOWERS, new GeneratorFlora(1, BlockBOPPlant.paging.getVariantState(BOPPlants.BUSH))); this.addGenerator("bushes", GeneratorStage.FLOWERS, new GeneratorFlora(1, BlockBOPPlant.paging.getVariantState(BOPPlants.BUSH)));
this.addGenerator("berry_bushes", GeneratorStage.FLOWERS, new GeneratorFlora(1, BlockBOPPlant.paging.getVariantState(BOPPlants.BERRYBUSH))); this.addGenerator("berry_bushes", GeneratorStage.FLOWERS, new GeneratorFlora(1, BlockBOPPlant.paging.getVariantState(BOPPlants.BERRYBUSH)));
this.addGenerator("shrubs", GeneratorStage.FLOWERS, new GeneratorFlora(1, BlockBOPPlant.paging.getVariantState(BOPPlants.SHRUB))); this.addGenerator("shrubs", GeneratorStage.FLOWERS, new GeneratorFlora(1, BlockBOPPlant.paging.getVariantState(BOPPlants.SHRUB)));
@ -64,16 +74,18 @@ public class BiomeGenDenseForest extends BOPBiome
} }
@Override @Override
public void genTerrainBlocks(World world, Random random, ChunkPrimer primer, int x, int z, double noise) public void configure(ConfigHelper conf)
{ {
this.topBlock = Blocks.grass.getDefaultState(); super.configure(conf);
this.fillerBlock = Blocks.dirt.getDefaultState();
if (noise > 1.75D) this.usualTopBlock = this.topBlock;
{ this.alternateTopBlock = conf.getBlockState("alternateTopBlock", this.alternateTopBlock);
this.topBlock = Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT);
} }
@Override
public void genTerrainBlocks(World world, Random random, ChunkPrimer primer, int x, int z, double noise)
{
this.topBlock = (noise > 1.75D) ? this.alternateTopBlock : this.usualTopBlock;
this.generateBiomeTerrain(world, random, primer, x, z, noise); this.generateBiomeTerrain(world, random, primer, x, z, noise);
} }