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);
}
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;
}
Aggregations