Search in sources :

Example 1 with IGrowthProvider

use of forestry.api.arboriculture.IGrowthProvider in project ForestryMC by ForestryMC.

the class TreeDecorator method generateBiomeCache.

private static void generateBiomeCache(World world, Random rand) {
    for (IAlleleTreeSpecies species : getSpecies()) {
        IAllele[] template = TreeManager.treeRoot.getTemplate(species);
        ITreeGenome genome = TreeManager.treeRoot.templateAsGenome(template);
        ITree tree = TreeManager.treeRoot.getTree(world, genome);
        IGrowthProvider growthProvider = species.getGrowthProvider();
        for (Biome biome : Biome.REGISTRY) {
            Set<ITree> trees = biomeCache.computeIfAbsent(biome.getRegistryName(), k -> new HashSet<>());
            if (growthProvider.isBiomeValid(tree, biome)) {
                trees.add(tree);
            }
        }
    }
}
Also used : IAllele(forestry.api.genetics.IAllele) IAlleleTreeSpecies(forestry.api.arboriculture.IAlleleTreeSpecies) Biome(net.minecraft.world.biome.Biome) IGrowthProvider(forestry.api.arboriculture.IGrowthProvider) ITree(forestry.api.arboriculture.ITree) ITreeGenome(forestry.api.arboriculture.ITreeGenome)

Aggregations

IAlleleTreeSpecies (forestry.api.arboriculture.IAlleleTreeSpecies)1 IGrowthProvider (forestry.api.arboriculture.IGrowthProvider)1 ITree (forestry.api.arboriculture.ITree)1 ITreeGenome (forestry.api.arboriculture.ITreeGenome)1 IAllele (forestry.api.genetics.IAllele)1 Biome (net.minecraft.world.biome.Biome)1