Add Brushland biome

This commit is contained in:
Cheeserolls 2015-06-16 14:23:05 +01:00
parent d2a5db2bbb
commit 46bc08a25c
5 changed files with 88 additions and 3 deletions

View file

@ -52,6 +52,7 @@ public class BOPBiome extends BiomeGenBase implements IExtendedBiome
this.theBiomeDecorator.sandPerChunk = -999; this.theBiomeDecorator.sandPerChunk = -999;
this.theBiomeDecorator.sandPerChunk2 = -999; this.theBiomeDecorator.sandPerChunk2 = -999;
this.theBiomeDecorator.clayPerChunk = -999; this.theBiomeDecorator.clayPerChunk = -999;
this.theBiomeDecorator.generateLakes = false;
this.setOctaveWeights(1, 1, 1, 1, 1, 1); this.setOctaveWeights(1, 1, 1, 1, 1, 1);
} }

View file

@ -21,6 +21,7 @@ public class BOPBiomes
public static Optional<BiomeGenBase> bayou = Optional.absent(); public static Optional<BiomeGenBase> bayou = Optional.absent();
public static Optional<BiomeGenBase> bog = Optional.absent(); public static Optional<BiomeGenBase> bog = Optional.absent();
public static Optional<BiomeGenBase> boreal_forest = Optional.absent(); public static Optional<BiomeGenBase> boreal_forest = Optional.absent();
public static Optional<BiomeGenBase> brushland = Optional.absent();
public static Optional<BiomeGenBase> crag = Optional.absent(); public static Optional<BiomeGenBase> crag = Optional.absent();
public static Optional<BiomeGenBase> chaparral = Optional.absent(); public static Optional<BiomeGenBase> chaparral = Optional.absent();
public static Optional<BiomeGenBase> denseForest = Optional.absent(); public static Optional<BiomeGenBase> denseForest = Optional.absent();

View file

@ -0,0 +1,75 @@
package biomesoplenty.common.biome.overworld;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.BlockPlanks;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.block.material.Material;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.BiomeManager.BiomeType;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.common.block.BlockBOPSand;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod;
import biomesoplenty.common.world.feature.GeneratorFlora;
import biomesoplenty.common.world.feature.GeneratorGrass;
import biomesoplenty.common.world.feature.GeneratorSplotches;
import biomesoplenty.common.world.feature.tree.GeneratorBasicTree;
import biomesoplenty.common.world.feature.tree.GeneratorTwigletTree;
public class BiomeGenBrushland extends BOPBiome
{
public BiomeGenBrushland()
{
// terrain
this.bopMinHeight = 60;
this.bopMaxHeight = 90;
this.setColor(0xC9C17F);
this.setTemperatureRainfall(1.2F, 0.1F);
this.addWeight(BiomeType.DESERT, 10);
// quicksand
this.addGenerator("quicksand_patches", GeneratorStage.SAND, (new GeneratorSplotches.Builder()).amountPerChunk(0.6F).splotchSize(16).with(BOPBlocks.sand.getDefaultState().withProperty(BlockBOPSand.VARIANT, BlockBOPSand.SandType.QUICKSAND)).splotchSize(20).scatterYMethod(ScatterYMethod.AT_SURFACE).create());
// trees & logs
GeneratorWeighted treeGenerator = new GeneratorWeighted(2.4F);
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_bush", 1, (new GeneratorFlora.Builder()).placeOn(this.topBlock).replace(Material.air).withNonDecayingLeaf(BlockPlanks.EnumType.OAK).generationAttempts(8).create());
// flowers
GeneratorWeighted flowerGenerator = new GeneratorWeighted(0.6F);
this.addGenerator("flowers", GeneratorStage.GRASS, flowerGenerator);
flowerGenerator.add("allium", 2, (new GeneratorFlora.Builder().with(BlockFlower.EnumFlowerType.ALLIUM).create()));
// grasses
GeneratorWeighted grassGenerator = new GeneratorWeighted(2.4F);
this.addGenerator("grass", GeneratorStage.GRASS, grassGenerator);
grassGenerator.add("wheatgrass", 1, (new GeneratorGrass.Builder()).with(BOPPlants.WHEATGRASS).create());
grassGenerator.add("tallgrass", 2, (new GeneratorGrass.Builder()).with(BlockTallGrass.EnumType.GRASS).create());
// other plants
this.addGenerator("shrubs", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(2.0F).with(BOPPlants.SHRUB).create());
this.addGenerator("thorns", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(1.0F).with(BOPPlants.THORN).create());
this.addGenerator("water_reeds", GeneratorStage.LILYPAD, (new GeneratorFlora.Builder()).amountPerChunk(3.0F).with(BOPPlants.REED).generationAttempts(32).create());
}
@Override
public int getGrassColorAtPos(BlockPos pos)
{
return 0xC9C17F;
}
@Override
public int getFoliageColorAtPos(BlockPos pos)
{
return 0xB2C67F;
}
}

View file

@ -146,6 +146,7 @@ public class ModBiomes
bayou = registerBOPBiome(new BiomeGenBayou(), "Bayou"); bayou = registerBOPBiome(new BiomeGenBayou(), "Bayou");
bog = registerBOPBiome(new BiomeGenBog(), "Bog"); bog = registerBOPBiome(new BiomeGenBog(), "Bog");
boreal_forest = registerBOPBiome(new BiomeGenBorealForest(), "Boreal Forest"); boreal_forest = registerBOPBiome(new BiomeGenBorealForest(), "Boreal Forest");
brushland = registerBOPBiome(new BiomeGenBrushland(), "Brushland");
crag = registerBOPBiome(new BiomeGenCrag(), "Crag"); crag = registerBOPBiome(new BiomeGenCrag(), "Crag");
chaparral = registerBOPBiome(new BiomeGenChaparral(), "Chaparral"); chaparral = registerBOPBiome(new BiomeGenChaparral(), "Chaparral");
denseForest = registerBOPBiome(new BiomeGenDenseForest(), "Dense Forest"); denseForest = registerBOPBiome(new BiomeGenDenseForest(), "Dense Forest");

View file

@ -34,6 +34,10 @@ public class GeneratorBasicTree extends GeneratorTreeBase
// TODO: update neighbours in builder? // TODO: update neighbours in builder?
public static class Builder extends GeneratorTreeBase.InnerBuilder<Builder, GeneratorBasicTree> implements IGeneratorBuilder<GeneratorBasicTree> public static class Builder extends GeneratorTreeBase.InnerBuilder<Builder, GeneratorBasicTree> implements IGeneratorBuilder<GeneratorBasicTree>
{ {
protected int leafLayers;
public Builder leafLayers(int a) {this.leafLayers = a; return this.self();}
public Builder() public Builder()
{ {
// defaults // defaults
@ -45,21 +49,24 @@ public class GeneratorBasicTree extends GeneratorTreeBase
this.vine = null; this.vine = null;
this.minHeight = 4; this.minHeight = 4;
this.maxHeight = 7; this.maxHeight = 7;
this.leafLayers = 4;
} }
@Override @Override
public GeneratorBasicTree create() public GeneratorBasicTree create()
{ {
return new GeneratorBasicTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.minHeight, this.maxHeight, false); return new GeneratorBasicTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.minHeight, this.maxHeight, false, this.leafLayers);
} }
} }
private boolean updateNeighbours; private boolean updateNeighbours;
private int leafLayers;
public GeneratorBasicTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, int minHeight, int maxHeight, boolean updateNeighbours) public GeneratorBasicTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, int minHeight, int maxHeight, boolean updateNeighbours, int leafLayers)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, minHeight, maxHeight);
this.updateNeighbours = updateNeighbours; this.updateNeighbours = updateNeighbours;
this.leafLayers = leafLayers;
} }
@Override @Override
@ -123,7 +130,7 @@ public class GeneratorBasicTree extends GeneratorTreeBase
if (this.placeOn.matches(world, soilPos) && isSoil && pos.getY() < 256 - height - 1) if (this.placeOn.matches(world, soilPos) && isSoil && pos.getY() < 256 - height - 1)
{ {
soil.onPlantGrow(world, soilPos, pos); soil.onPlantGrow(world, soilPos, pos);
int leavesLayers = 3; int leavesLayers = (this.leafLayers - 1);
//Generates leaves at the top of the tree, going one block above the top log (<= rather than <) //Generates leaves at the top of the tree, going one block above the top log (<= rather than <)
for (int y = pos.getY() + height - leavesLayers; y <= pos.getY() + height; y++) for (int y = pos.getY() + height - leavesLayers; y <= pos.getY() + height; y++)