Search in sources :

Example 1 with WorldGenArboriculture

use of forestry.arboriculture.worldgen.WorldGenArboriculture in project ForestryMC by ForestryMC.

the class TileSapling method canAcceptBoneMeal.

public boolean canAcceptBoneMeal(Random rand) {
    ITree tree = getTree();
    if (tree == null) {
        return false;
    }
    int maturity = getRequiredMaturity(world, tree);
    if (timesTicked < maturity) {
        return true;
    }
    WorldGenerator generator = tree.getTreeGenerator(world, getPos(), true);
    if (generator instanceof WorldGenArboriculture) {
        WorldGenArboriculture arboricultureGenerator = (WorldGenArboriculture) generator;
        arboricultureGenerator.preGenerate(world, rand, getPos());
        return arboricultureGenerator.getValidGrowthPos(world, getPos()) != null;
    } else {
        return true;
    }
}
Also used : WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) WorldGenArboriculture(forestry.arboriculture.worldgen.WorldGenArboriculture) ITree(forestry.api.arboriculture.ITree)

Aggregations

ITree (forestry.api.arboriculture.ITree)1 WorldGenArboriculture (forestry.arboriculture.worldgen.WorldGenArboriculture)1 WorldGenerator (net.minecraft.world.gen.feature.WorldGenerator)1