130 lines
6.6 KiB
Java
130 lines
6.6 KiB
Java
/*******************************************************************************
|
|
* Copyright 2015-2016, the Biomes O' Plenty Team
|
|
*
|
|
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
|
|
*
|
|
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
|
******************************************************************************/
|
|
|
|
package biomesoplenty.common.biome.overworld;
|
|
|
|
import java.util.Random;
|
|
|
|
import biomesoplenty.api.block.BOPBlocks;
|
|
import biomesoplenty.api.block.BlockQueries;
|
|
import biomesoplenty.api.config.IConfigObj;
|
|
import biomesoplenty.api.enums.BOPClimates;
|
|
import biomesoplenty.api.enums.BOPGems;
|
|
import biomesoplenty.api.enums.BOPPlants;
|
|
import biomesoplenty.api.enums.BOPTrees;
|
|
import biomesoplenty.api.generation.GeneratorStage;
|
|
import biomesoplenty.common.block.BlockBOPCoral;
|
|
import biomesoplenty.common.block.BlockBOPPlant;
|
|
import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod;
|
|
import biomesoplenty.common.world.generator.GeneratorColumns;
|
|
import biomesoplenty.common.world.generator.GeneratorDoubleFlora;
|
|
import biomesoplenty.common.world.generator.GeneratorFlora;
|
|
import biomesoplenty.common.world.generator.GeneratorGrass;
|
|
import biomesoplenty.common.world.generator.GeneratorOreSingle;
|
|
import biomesoplenty.common.world.generator.GeneratorWeighted;
|
|
import biomesoplenty.common.world.generator.tree.GeneratorBulbTree;
|
|
import biomesoplenty.common.world.generator.tree.GeneratorTwigletTree;
|
|
import net.minecraft.block.BlockDirt;
|
|
import net.minecraft.block.BlockDoublePlant;
|
|
import net.minecraft.block.BlockFlower;
|
|
import net.minecraft.block.BlockTallGrass;
|
|
import net.minecraft.block.state.IBlockState;
|
|
import net.minecraft.entity.passive.EntityOcelot;
|
|
import net.minecraft.init.Blocks;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.world.World;
|
|
import net.minecraft.world.chunk.ChunkPrimer;
|
|
|
|
public class BiomeGenBambooForest extends BOPOverworldBiome
|
|
{
|
|
|
|
public IBlockState usualTopBlock;
|
|
public IBlockState alternateTopBlock;
|
|
|
|
public BiomeGenBambooForest()
|
|
{
|
|
super("bamboo_forest", new PropsBuilder("Bamboo Forest").withGuiColour(0xA3E053).withRainfall(0.85F).withTemperature(0.9F));
|
|
|
|
// terrain
|
|
this.terrainSettings.avgHeight(68).heightVariation(5, 10);
|
|
|
|
this.canGenerateVillages = false;
|
|
|
|
this.addWeight(BOPClimates.TROPICAL, 3);
|
|
|
|
this.spawnableCreatureList.clear();
|
|
this.spawnableMonsterList.add(new SpawnListEntry(EntityOcelot.class, 2, 1, 1));
|
|
|
|
this.topBlock = Blocks.DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.PODZOL);
|
|
this.usualTopBlock = this.topBlock;
|
|
this.alternateTopBlock = Blocks.GRASS.getDefaultState();
|
|
|
|
// flowers
|
|
GeneratorWeighted flowerGenerator = new GeneratorWeighted(0.5F);
|
|
this.addGenerator("flowers", GeneratorStage.FLOWERS, flowerGenerator);
|
|
flowerGenerator.add("dandelion", 1, (new GeneratorFlora.Builder().with(BlockFlower.EnumFlowerType.DANDELION).create()));
|
|
flowerGenerator.add("poppy", 1, (new GeneratorFlora.Builder().with(BlockFlower.EnumFlowerType.POPPY).create()));
|
|
|
|
// trees & logs
|
|
GeneratorWeighted treeGenerator = new GeneratorWeighted(30);
|
|
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
|
|
treeGenerator.add("bamboo", 3, (new GeneratorBulbTree.Builder()).minHeight(10).maxHeight(20).log(BOPBlocks.bamboo.getDefaultState()).leaves(BOPTrees.BAMBOO).create());
|
|
treeGenerator.add("bamboo_thin", 1, (new GeneratorTwigletTree.Builder()).minHeight(5).maxHeight(10).leafChance(0.3F).log(BOPBlocks.bamboo.getDefaultState()).leaves(BOPTrees.BAMBOO).create());
|
|
//treeGenerator.add("oak_bush", 1, (new GeneratorBush.Builder()).maxHeight(2).create());
|
|
|
|
// grasses
|
|
GeneratorWeighted grassGenerator = new GeneratorWeighted(2.6F);
|
|
this.addGenerator("grass", GeneratorStage.GRASS, grassGenerator);
|
|
grassGenerator.add("shortgrass", 1, (new GeneratorGrass.Builder()).with(BOPPlants.SHORTGRASS).create());
|
|
grassGenerator.add("mediumgrass", 1, (new GeneratorGrass.Builder()).with(BOPPlants.MEDIUMGRASS).create());
|
|
//grassGenerator.add("dampgrass", 1, (new GeneratorGrass.Builder()).with(BOPPlants.DAMPGRASS).create());
|
|
grassGenerator.add("tallgrass", 1, (new GeneratorGrass.Builder()).with(BlockTallGrass.EnumType.GRASS).create());
|
|
grassGenerator.add("doublegrass", 2, (new GeneratorDoubleFlora.Builder()).with(BlockDoublePlant.EnumPlantType.GRASS).create());
|
|
|
|
// other plants
|
|
this.addGenerator("leaf_piles", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(3.0F).placeOn(BlockQueries.fertile).with(BOPPlants.LEAFPILE).create());
|
|
this.addGenerator("ferns", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(4.0F).with(BlockTallGrass.EnumType.FERN).create());
|
|
this.addGenerator("river_cane", GeneratorStage.FLOWERS,(new GeneratorColumns.Builder()).amountPerChunk(5.0F).generationAttempts(24).placeOn(BlockQueries.litFertileWaterside).with(BlockBOPPlant.paging.getVariantState(BOPPlants.RIVERCANE)).minHeight(1).maxHeight(3).create());
|
|
this.addGenerator("algae", GeneratorStage.LILYPAD, (new GeneratorFlora.Builder()).amountPerChunk(4.0F).replace(Blocks.WATER).with(BOPBlocks.coral.getDefaultState().withProperty(BlockBOPCoral.VARIANT, BlockBOPCoral.CoralType.ALGAE)).scatterYMethod(ScatterYMethod.AT_GROUND).create());
|
|
this.addGenerator("bushes", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.5F).with(BOPPlants.BUSH).create());
|
|
|
|
// gem
|
|
this.addGenerator("topaz", GeneratorStage.SAND, (new GeneratorOreSingle.Builder()).amountPerChunk(12).with(BOPGems.TOPAZ).create());
|
|
|
|
|
|
}
|
|
|
|
@Override
|
|
public void configure(IConfigObj conf)
|
|
{
|
|
super.configure(conf);
|
|
|
|
this.usualTopBlock = this.topBlock;
|
|
this.alternateTopBlock = conf.getBlockState("alternateTopBlock", this.alternateTopBlock);
|
|
}
|
|
|
|
@Override
|
|
public void genTerrainBlocks(World world, Random rand, ChunkPrimer primer, int x, int z, double noise)
|
|
{
|
|
this.topBlock = (noise + rand.nextDouble() * 3.0D > 1.8D) ? this.alternateTopBlock : this.usualTopBlock;
|
|
super.genTerrainBlocks(world, rand, primer, x, z, noise);
|
|
}
|
|
|
|
@Override
|
|
public int getGrassColorAtPos(BlockPos pos)
|
|
{
|
|
return getModdedBiomeGrassColor(0xBBDD54);
|
|
}
|
|
|
|
@Override
|
|
public int getFoliageColorAtPos(BlockPos pos)
|
|
{
|
|
return getModdedBiomeFoliageColor(0xBBDD54);
|
|
}
|
|
}
|