diff --git a/src/main/java/biomesoplenty/api/biome/BOPBiomes.java b/src/main/java/biomesoplenty/api/biome/BOPBiomes.java index 6afa78b22..0c684fa11 100644 --- a/src/main/java/biomesoplenty/api/biome/BOPBiomes.java +++ b/src/main/java/biomesoplenty/api/biome/BOPBiomes.java @@ -53,6 +53,7 @@ public class BOPBiomes public static Optional origin_valley = Optional.absent(); public static Optional outback = Optional.absent(); public static Optional prairie = Optional.absent(); + public static Optional sacred_springs = Optional.absent(); public static Optional shrubland = Optional.absent(); public static Optional steppe = Optional.absent(); public static Optional thicket = Optional.absent(); diff --git a/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenPrairie.java b/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenPrairie.java index 787acf251..00291f44c 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenPrairie.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenPrairie.java @@ -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) { diff --git a/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenSacredSprings.java b/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenSacredSprings.java new file mode 100644 index 000000000..ff355bd9c --- /dev/null +++ b/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenSacredSprings.java @@ -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; + } +} diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPSapling.java b/src/main/java/biomesoplenty/common/block/BlockBOPSapling.java index 7af700c89..710b12d2f 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPSapling.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPSapling.java @@ -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 diff --git a/src/main/java/biomesoplenty/common/init/ModBiomes.java b/src/main/java/biomesoplenty/common/init/ModBiomes.java index 53f5da48c..1901a2367 100644 --- a/src/main/java/biomesoplenty/common/init/ModBiomes.java +++ b/src/main/java/biomesoplenty/common/init/ModBiomes.java @@ -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"); diff --git a/src/main/java/biomesoplenty/common/world/feature/tree/GeneratorBigTree.java b/src/main/java/biomesoplenty/common/world/feature/tree/GeneratorBigTree.java index 6febffef1..f6bceb83d 100644 --- a/src/main/java/biomesoplenty/common/world/feature/tree/GeneratorBigTree.java +++ b/src/main/java/biomesoplenty/common/world/feature/tree/GeneratorBigTree.java @@ -38,6 +38,7 @@ public class GeneratorBigTree extends GeneratorTreeBase // TODO: update neighbours in builder? public static class Builder extends GeneratorTreeBase.InnerBuilder implements IGeneratorBuilder { + 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; - 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; }