Add Canyon biome (and Canyon Ravine sub biome

This commit is contained in:
Cheeserolls 2015-06-16 16:17:19 +01:00
parent 60f8a5dc00
commit d522fc9fc8
4 changed files with 103 additions and 0 deletions

View file

@ -22,6 +22,7 @@ public class BOPBiomes
public static Optional<BiomeGenBase> bog = Optional.absent();
public static Optional<BiomeGenBase> boreal_forest = Optional.absent();
public static Optional<BiomeGenBase> brushland = Optional.absent();
public static Optional<BiomeGenBase> canyon = Optional.absent();
public static Optional<BiomeGenBase> crag = Optional.absent();
public static Optional<BiomeGenBase> chaparral = Optional.absent();
public static Optional<BiomeGenBase> denseForest = Optional.absent();
@ -45,4 +46,6 @@ public class BOPBiomes
// edge-biomes, sub-biomes and mutated-biomes
public static Optional<BiomeGenBase> glacier = Optional.absent();
public static Optional<BiomeGenBase> mountainFoothills = Optional.absent();
public static Optional<BiomeGenBase> canyonRavine = Optional.absent();
}

View file

@ -0,0 +1,94 @@
package biomesoplenty.common.biome.overworld;
import net.minecraft.block.BlockPlanks;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.init.Blocks;
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.enums.BOPFlowers;
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.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.GeneratorBush;
import biomesoplenty.common.world.feature.tree.GeneratorPineTree;
public class BiomeGenCanyon extends BOPBiome
{
public static enum CanyonType {PLATEAU, RAVINE}
// TODO: placement of ravine is not ideal - out to be tied to the rivers layer somehow, instead of being a subbiome
public BiomeGenCanyon(CanyonType type)
{
// terrain
if (type == CanyonType.PLATEAU)
{
this.bopMinHeight = 144;
this.bopMaxHeight = 158;
this.addWeight(BiomeType.DESERT, 5);
}
else
{
this.bopMinHeight = 50;
this.bopMaxHeight = 94;
}
this.setColor(0xB49C70);
this.setTemperatureRainfall(1.0F, 0.3F);
this.spawnableCreatureList.clear();
this.topBlock = BOPBlocks.hard_dirt.getDefaultState();
this.fillerBlock = BOPBlocks.hard_dirt.getDefaultState();
// splatter top blocks
IBlockPosQuery emptyHardDirt = BlockQuery.buildAnd().withAirAbove().states(this.topBlock).create();
this.addGenerator("grass_splatter", GeneratorStage.SAND, (new GeneratorSplatter.Builder()).amountPerChunk(4.0F).generationAttempts(128).replace(emptyHardDirt).with(Blocks.grass.getDefaultState()).create());
// trees and logs
GeneratorWeighted treeGenerator = new GeneratorWeighted(5);
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
treeGenerator.add("pine", 1, (new GeneratorPineTree.Builder()).minHeight(6).maxHeight(18).placeOn(emptyHardDirt).create());
treeGenerator.add("brush", 2, (new GeneratorBush.Builder()).log(BlockPlanks.EnumType.ACACIA).leaves(BlockPlanks.EnumType.ACACIA).placeOn(emptyHardDirt).create());
// flowers
GeneratorWeighted flowerGenerator = new GeneratorWeighted(0.5F);
this.addGenerator("flowers", GeneratorStage.GRASS, flowerGenerator);
flowerGenerator.add("bromeliad", 2, (new GeneratorFlora.Builder().with(BOPFlowers.BROMELIAD).create()));
// water plants
this.addGenerator("water_reeds", GeneratorStage.LILYPAD, (new GeneratorFlora.Builder()).amountPerChunk(2.0F).with(BOPPlants.REED).generationAttempts(32).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("mediumgrass", 1, (new GeneratorGrass.Builder()).with(BOPPlants.MEDIUMGRASS).create());
grassGenerator.add("tallgrass", 2, (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 int getGrassColorAtPos(BlockPos pos)
{
return 0xA9BA64;
}
@Override
public int getFoliageColorAtPos(BlockPos pos)
{
return 0xA9BA64;
}
}

View file

@ -147,6 +147,7 @@ public class ModBiomes
bog = registerBOPBiome(new BiomeGenBog(), "Bog");
boreal_forest = registerBOPBiome(new BiomeGenBorealForest(), "Boreal Forest");
brushland = registerBOPBiome(new BiomeGenBrushland(), "Brushland");
canyon = registerBOPBiome(new BiomeGenCanyon(BiomeGenCanyon.CanyonType.PLATEAU), "Canyon");
crag = registerBOPBiome(new BiomeGenCrag(), "Crag");
chaparral = registerBOPBiome(new BiomeGenChaparral(), "Chaparral");
denseForest = registerBOPBiome(new BiomeGenDenseForest(), "Dense Forest");
@ -170,10 +171,12 @@ public class ModBiomes
// edge-biomes, sub-biomes and mutated-biomes
mountainFoothills = registerBOPBiome(new BiomeGenMountain(BiomeGenMountain.MountainType.FOOTHILLS), "Mountain Foothills");
canyonRavine = registerBOPBiome(new BiomeGenCanyon(BiomeGenCanyon.CanyonType.RAVINE), "Canyon Ravine");
glacier = registerBOPBiome(new BiomeGenGlacier(), "Glacier"); // TODO: implement glacier
setSubBiome(Optional.of(BiomeGenBase.frozenOcean), arctic); // add some arctic regions in frozen oceans
setSubBiome(arctic, glacier);
setSubBiome(canyon, canyonRavine);
}

View file

@ -40,6 +40,9 @@ public class GenLayerBiomeEdgeBOP extends GenLayer
// line BOP mountain peaks with BOP mountain foothills
if (this.replaceBiomeEdge(parentVals, out, x, y, areaWidth, biomeId, BOPBiomes.mountain, BOPBiomes.mountainFoothills)) {continue;}
// line BOP canyon with BOP canyon ravine
if (this.replaceBiomeEdge(parentVals, out, x, y, areaWidth, biomeId, BOPBiomes.canyon, BOPBiomes.canyonRavine)) {continue;}
// line extreme hills with extreme hills edge
if (this.replaceBiomeEdgeIfNecessary(parentVals, out, x, y, areaWidth, biomeId, BiomeGenBase.extremeHills.biomeID, BiomeGenBase.extremeHillsEdge.biomeID)) {continue;}