Search in sources :

Example 1 with ITreeRoot

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

the class FarmableGE method plantSaplingAt.

@Override
public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) {
    ITreeRoot treeRoot = TreeManager.treeRoot;
    ITree tree = treeRoot.getMember(germling);
    return tree != null && treeRoot.plantSapling(world, tree, player.getGameProfile(), pos);
}
Also used : ITreeRoot(forestry.api.arboriculture.ITreeRoot) ITree(forestry.api.arboriculture.ITree)

Example 2 with ITreeRoot

use of forestry.api.arboriculture.ITreeRoot in project Binnie by ForestryMC.

the class PagePlanksTrees method getTreesThatMakePlanks.

private static Collection<IAlleleSpecies> getTreesThatMakePlanks(ItemStack fruit, boolean master, World world, GameProfile player) {
    if (fruit == null) {
        return new ArrayList<>();
    }
    ITreeRoot treeRoot = TreeManager.treeRoot;
    IBreedingSystem system = Binnie.GENETICS.getSystem(treeRoot);
    final Collection<IAlleleSpecies> set = master ? system.getAllSpecies() : system.getDiscoveredSpecies(world, player);
    final List<IAlleleSpecies> found = new ArrayList<>();
    for (final IAlleleSpecies species : set) {
        final IAlleleTreeSpecies tSpecies = (IAlleleTreeSpecies) species;
        ITreeGenome genome = treeRoot.templateAsGenome(treeRoot.getTemplate(tSpecies));
        IAlleleTreeSpecies treeSpecies = genome.getPrimary();
        final ItemStack woodStack = treeSpecies.getWoodProvider().getWoodStack();
        ItemStack plankProduct = LumbermillRecipeManager.getPlankProduct(woodStack, world);
        if (!plankProduct.isEmpty() && fruit.isItemEqual(plankProduct)) {
            found.add(species);
        }
    }
    return found;
}
Also used : IAlleleTreeSpecies(forestry.api.arboriculture.IAlleleTreeSpecies) ITreeRoot(forestry.api.arboriculture.ITreeRoot) IAlleleSpecies(forestry.api.genetics.IAlleleSpecies) ArrayList(java.util.ArrayList) IBreedingSystem(binnie.core.api.genetics.IBreedingSystem) ItemStack(net.minecraft.item.ItemStack) ITreeGenome(forestry.api.arboriculture.ITreeGenome)

Aggregations

ITreeRoot (forestry.api.arboriculture.ITreeRoot)2 IBreedingSystem (binnie.core.api.genetics.IBreedingSystem)1 IAlleleTreeSpecies (forestry.api.arboriculture.IAlleleTreeSpecies)1 ITree (forestry.api.arboriculture.ITree)1 ITreeGenome (forestry.api.arboriculture.ITreeGenome)1 IAlleleSpecies (forestry.api.genetics.IAlleleSpecies)1 ArrayList (java.util.ArrayList)1 ItemStack (net.minecraft.item.ItemStack)1