Added the Sacred Springs and its corresponding sapling

This commit is contained in:
Adubbz 2016-01-12 12:52:02 +11:00
parent 38cd1655e1
commit c996b9cced
6 changed files with 112 additions and 5 deletions

View file

@ -53,6 +53,7 @@ public class BOPBiomes
public static Optional<BiomeGenBase> origin_valley = Optional.absent();
public static Optional<BiomeGenBase> outback = Optional.absent();
public static Optional<BiomeGenBase> prairie = Optional.absent();
public static Optional<BiomeGenBase> sacred_springs = Optional.absent();
public static Optional<BiomeGenBase> shrubland = Optional.absent();
public static Optional<BiomeGenBase> steppe = Optional.absent();
public static Optional<BiomeGenBase> thicket = Optional.absent();

View file

@ -9,6 +9,7 @@ import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPFlowers;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.world.BOPWorldSettings;
import biomesoplenty.common.world.feature.GeneratorDoubleFlora;
import biomesoplenty.common.world.feature.GeneratorFlora;
import biomesoplenty.common.world.feature.GeneratorGrass;
@ -65,6 +66,12 @@ public class BiomeGenPrairie extends BOPBiome
this.addGenerator("tanzanite", GeneratorStage.SAND, (new GeneratorOreSingle.Builder()).amountPerChunk(12).with(BOPGems.TANZANITE).create());
}
@Override
public void applySettings(BOPWorldSettings settings)
{
if (!settings.generateBopGems) {this.removeGenerator("tanzanite");}
}
@Override
public int getGrassColorAtPos(BlockPos pos)
{

View file

@ -0,0 +1,84 @@
package biomesoplenty.common.biome.overworld;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPFlowers;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.enums.BOPTrees;
import biomesoplenty.common.enums.BOPWoods;
import biomesoplenty.common.world.BOPWorldSettings;
import biomesoplenty.common.world.feature.GeneratorDoubleFlora;
import biomesoplenty.common.world.feature.GeneratorFlora;
import biomesoplenty.common.world.feature.GeneratorGrass;
import biomesoplenty.common.world.feature.GeneratorMixedLily;
import biomesoplenty.common.world.feature.GeneratorOreSingle;
import biomesoplenty.common.world.feature.tree.GeneratorBigTree;
import biomesoplenty.common.world.feature.tree.GeneratorBush;
import net.minecraft.block.BlockDoublePlant;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.block.BlockFlower.EnumFlowerType;
import net.minecraft.util.BlockPos;
public class BiomeGenSacredSprings extends BOPBiome
{
public BiomeGenSacredSprings()
{
// terrain
this.terrainSettings.avgHeight(62).heightVariation(11, 45);
this.setColor(39259);
this.setTemperatureRainfall(1.2F, 0.9F);
this.addWeight(BOPClimates.WARM_TEMPERATE, 3);
// trees
this.addGenerator("sacred_oak_trees", GeneratorStage.POST, (new GeneratorBigTree.Builder()).amountPerChunk(0.2F).log(BOPWoods.SACRED_OAK).leaves(BOPTrees.SACRED_OAK).minHeight(35).maxHeight(45).trunkWidth(2).foliageDensity(1.25D).create());
this.addGenerator("leaves_clusters", GeneratorStage.TREE, (new GeneratorBush.Builder()).amountPerChunk(12.5F).create());
// grasses
GeneratorWeighted grassGenerator = new GeneratorWeighted(2.75F);
this.addGenerator("grass", GeneratorStage.GRASS, grassGenerator);
grassGenerator.add("wheatgrass", 1, (new GeneratorGrass.Builder()).with(BOPPlants.WHEATGRASS).create());
grassGenerator.add("dampgrass", 2, (new GeneratorGrass.Builder()).with(BOPPlants.DAMPGRASS).create());
grassGenerator.add("tallgrass", 2, (new GeneratorGrass.Builder()).with(BlockTallGrass.EnumType.GRASS).create());
// flowers
GeneratorWeighted flowerGenerator = new GeneratorWeighted(0.15F);
this.addGenerator("flowers", GeneratorStage.FLOWERS, flowerGenerator);
flowerGenerator.add("pink_daffodils", 3, (new GeneratorFlora.Builder().with(BOPFlowers.PINK_DAFFODIL).create()));
flowerGenerator.add("poppies", 2, (new GeneratorFlora.Builder().with(EnumFlowerType.POPPY).create()));
flowerGenerator.add("paeonias", 1, (new GeneratorDoubleFlora.Builder()).with(BlockDoublePlant.EnumPlantType.PAEONIA).create());
// other plants
this.addGenerator("leaf_piles", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(2.5F).with(BOPPlants.LEAFPILE).create());
// water plants
this.addGenerator("mixed_lily", GeneratorStage.LILYPAD, (new GeneratorMixedLily.Builder()).amountPerChunk(1.0F).generationAttempts(96).create());
// gem
this.addGenerator("topaz", GeneratorStage.SAND, (new GeneratorOreSingle.Builder()).amountPerChunk(12).with(BOPGems.TOPAZ).create());
}
@Override
public void applySettings(BOPWorldSettings settings)
{
if (!settings.generateBopGems) {this.removeGenerator("topaz");}
}
@Override
public int getGrassColorAtPos(BlockPos pos)
{
double noise = GRASS_COLOR_NOISE.func_151601_a((double)pos.getX() * 0.0225D, (double)pos.getZ() * 0.0225D);
return noise < -0.1D ? 39285 : 39259;
}
@Override
public int getFoliageColorAtPos(BlockPos pos)
{
double noise = GRASS_COLOR_NOISE.func_151601_a((double)pos.getX() * 0.0225D, (double)pos.getZ() * 0.0225D);
return noise < -0.1D ? 39285 : 39259;
}
}

View file

@ -10,6 +10,7 @@ package biomesoplenty.common.block;
import java.util.Random;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.api.block.BlockQueries;
import biomesoplenty.common.enums.BOPTrees;
@ -18,6 +19,7 @@ import biomesoplenty.common.item.ItemBOPSapling;
import biomesoplenty.common.util.block.VariantPagingHelper;
import biomesoplenty.common.world.feature.tree.GeneratorBasicTree;
import biomesoplenty.common.world.feature.tree.GeneratorBayouTree;
import biomesoplenty.common.world.feature.tree.GeneratorBigTree;
import biomesoplenty.common.world.feature.tree.GeneratorBulbTree;
import biomesoplenty.common.world.feature.tree.GeneratorPineTree;
import biomesoplenty.common.world.feature.tree.GeneratorTaigaTree;
@ -184,8 +186,8 @@ public class BlockBOPSapling extends BlockBOPDecoration implements IGrowable {
return new WorldGenTrees(true);
case JACARANDA:
return new GeneratorBasicTree.Builder().minHeight(4).maxHeight(7).log(BOPWoods.JACARANDA).leaves(BOPTrees.JACARANDA).create();
case SACRED_OAK: //Not implemented
return new WorldGenTrees(true);
case SACRED_OAK:
return new GeneratorBigTree.Builder().log(BOPWoods.SACRED_OAK).leaves(BOPTrees.SACRED_OAK).minHeight(35).maxHeight(45).trunkWidth(2).foliageDensity(1.25D).create();
case MANGROVE: //Not implemented
return new WorldGenTrees(true);
case PALM: //Not implemented

View file

@ -63,6 +63,7 @@ import biomesoplenty.common.biome.overworld.BiomeGenMountain;
import biomesoplenty.common.biome.overworld.BiomeGenOriginValley;
import biomesoplenty.common.biome.overworld.BiomeGenOutback;
import biomesoplenty.common.biome.overworld.BiomeGenPrairie;
import biomesoplenty.common.biome.overworld.BiomeGenSacredSprings;
import biomesoplenty.common.biome.overworld.BiomeGenShrubland;
import biomesoplenty.common.biome.overworld.BiomeGenSteppe;
import biomesoplenty.common.biome.overworld.BiomeGenThicket;
@ -251,6 +252,7 @@ public class ModBiomes implements BOPBiomes.IBiomeRegistry
origin_valley = registerBOPBiome(new BiomeGenOriginValley(), "Origin Valley");
outback = registerBOPBiome(new BiomeGenOutback(), "Outback");
prairie = registerBOPBiome(new BiomeGenPrairie(), "Prairie");
sacred_springs = registerBOPBiome(new BiomeGenSacredSprings(), "Sacred Springs");
shrubland = registerBOPBiome(new BiomeGenShrubland(), "Shrubland");
steppe = registerBOPBiome(new BiomeGenSteppe(), "Steppe");
thicket = registerBOPBiome(new BiomeGenThicket(), "Thicket");

View file

@ -38,6 +38,7 @@ public class GeneratorBigTree extends GeneratorTreeBase
// TODO: update neighbours in builder?
public static class Builder extends GeneratorTreeBase.InnerBuilder<Builder, GeneratorBigTree> implements IGeneratorBuilder<GeneratorBigTree>
{
private int trunkWidth;
private int foliageHeight;
private double foliageDensity;
@ -53,11 +54,13 @@ public class GeneratorBigTree extends GeneratorTreeBase
this.minHeight = 5;
this.maxHeight = 17;
this.trunkWidth = 1;
this.foliageHeight = 4;
this.foliageDensity = 1.0F;
}
public Builder trunkWidth(int a) {this.trunkWidth = a; return this.self();}
public Builder foliageHeight(int a) {this.foliageHeight = a; return this.self();}
public Builder foliageDensity(double a) {this.foliageDensity = a; return this.self();}
@ -65,7 +68,7 @@ public class GeneratorBigTree extends GeneratorTreeBase
@Override
public GeneratorBigTree create()
{
return new GeneratorBigTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.minHeight, this.maxHeight, this.foliageHeight, this.foliageDensity, false);
return new GeneratorBigTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.minHeight, this.maxHeight, this.trunkWidth, this.foliageHeight, this.foliageDensity, false);
}
}
@ -90,11 +93,12 @@ public class GeneratorBigTree extends GeneratorTreeBase
private List<FoliageCoords> foliageCoords;
public GeneratorBigTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, int minHeight, int maxHeight, int foliageHeight, double foliageDensity, boolean updateNeighbours)
public GeneratorBigTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, int minHeight, int maxHeight, int trunkWidth, int foliageHeight, double foliageDensity, boolean updateNeighbours)
{
super(amountPerChunk, placeOn, replace, log, leaves, vine, minHeight, maxHeight);
this.foliageHeight = foliageHeight;
this.foliageDensity = foliageDensity;
this.trunkWidth = trunkWidth;
this.updateNeighbours = updateNeighbours;
}
@ -497,13 +501,20 @@ public class GeneratorBigTree extends GeneratorTreeBase
// Examine center column for how tall the tree can be.
int allowedHeight = checkLine(this.origin, this.origin.up(height - 1));
if (trunkWidth == 2)
{
allowedHeight = Math.min(checkLine(this.origin.east(), this.origin.east().up(height - 1)), allowedHeight);
allowedHeight = Math.min(checkLine(this.origin.east().south(), this.origin.east().south().up(height - 1)), allowedHeight);
allowedHeight = Math.min(checkLine(this.origin.south(), this.origin.south().up(height - 1)), allowedHeight);
}
// If the set height is good, go with that
if (allowedHeight == -1) {
return true;
}
// If the space is too short, tell the build to abort
if (allowedHeight < 6) {
if (allowedHeight < this.minHeight) {
return false;
}