Search in sources :

Example 1 with IFruitProvider

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

the class TileLeaves method determineFruitColour.

private int determineFruitColour() {
    ITree tree = getTree();
    if (tree == null) {
        tree = TreeDefinition.Cherry.getIndividual();
    }
    ITreeGenome genome = tree.getGenome();
    IFruitProvider fruit = genome.getFruitProvider();
    return fruit.getColour(genome, world, getPos(), getRipeningTime());
}
Also used : ITree(forestry.api.arboriculture.ITree) ITreeGenome(forestry.api.arboriculture.ITreeGenome) IFruitProvider(forestry.api.arboriculture.IFruitProvider)

Example 2 with IFruitProvider

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

the class ItemBlockDecorativeLeaves method getColorFromItemstack.

@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemstack(ItemStack itemStack, int renderPass) {
    int meta = itemStack.getMetadata();
    BlockDecorativeLeaves block = getBlock();
    TreeDefinition treeDefinition = block.getTreeType(meta);
    ITreeGenome genome = treeDefinition.getGenome();
    if (renderPass == BlockAbstractLeaves.FRUIT_COLOR_INDEX) {
        IFruitProvider fruitProvider = genome.getFruitProvider();
        return fruitProvider.getDecorativeColor();
    }
    return genome.getPrimary().getLeafSpriteProvider().getColor(false);
}
Also used : BlockDecorativeLeaves(forestry.arboriculture.blocks.BlockDecorativeLeaves) TreeDefinition(forestry.arboriculture.genetics.TreeDefinition) ITreeGenome(forestry.api.arboriculture.ITreeGenome) IFruitProvider(forestry.api.arboriculture.IFruitProvider) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 3 with IFruitProvider

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

the class Tree method allowsFruitBlocks.

@Override
public boolean allowsFruitBlocks() {
    IFruitProvider provider = getGenome().getFruitProvider();
    if (!provider.requiresFruitBlocks()) {
        return false;
    }
    Collection<IFruitFamily> suitable = genome.getPrimary().getSuitableFruit();
    return suitable.contains(provider.getFamily());
}
Also used : IFruitFamily(forestry.api.genetics.IFruitFamily) IFruitProvider(forestry.api.arboriculture.IFruitProvider)

Example 4 with IFruitProvider

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

the class Tree method trySpawnFruitBlock.

@Override
public boolean trySpawnFruitBlock(World world, Random rand, BlockPos pos) {
    IFruitProvider provider = getGenome().getFruitProvider();
    Collection<IFruitFamily> suitable = genome.getPrimary().getSuitableFruit();
    return suitable.contains(provider.getFamily()) && provider.trySpawnFruitBlock(getGenome(), world, rand, pos);
}
Also used : IFruitFamily(forestry.api.genetics.IFruitFamily) IFruitProvider(forestry.api.arboriculture.IFruitProvider)

Example 5 with IFruitProvider

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

the class BlockDecorativeLeaves method colorMultiplier.

@Override
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex) {
    TreeDefinition treeDefinition = state.getValue(getVariant());
    ITreeGenome genome = treeDefinition.getGenome();
    if (tintIndex == BlockAbstractLeaves.FRUIT_COLOR_INDEX) {
        IFruitProvider fruitProvider = genome.getFruitProvider();
        return fruitProvider.getDecorativeColor();
    }
    ILeafSpriteProvider spriteProvider = genome.getPrimary().getLeafSpriteProvider();
    return spriteProvider.getColor(false);
}
Also used : ILeafSpriteProvider(forestry.api.arboriculture.ILeafSpriteProvider) TreeDefinition(forestry.arboriculture.genetics.TreeDefinition) ITreeGenome(forestry.api.arboriculture.ITreeGenome) IFruitProvider(forestry.api.arboriculture.IFruitProvider) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

IFruitProvider (forestry.api.arboriculture.IFruitProvider)15 ITreeGenome (forestry.api.arboriculture.ITreeGenome)11 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)6 ITree (forestry.api.arboriculture.ITree)4 ItemStack (net.minecraft.item.ItemStack)4 ETTreeDefinition (binnie.extratrees.genetics.ETTreeDefinition)3 ILeafSpriteProvider (forestry.api.arboriculture.ILeafSpriteProvider)3 IFruitFamily (forestry.api.genetics.IFruitFamily)3 TreeDefinition (forestry.arboriculture.genetics.TreeDefinition)3 IBreedingSystem (binnie.core.api.genetics.IBreedingSystem)1 ControlText (binnie.core.gui.controls.ControlText)1 Control (binnie.core.gui.controls.core.Control)1 ControlScrollableContent (binnie.core.gui.controls.scroll.ControlScrollableContent)1 Area (binnie.core.gui.geometry.Area)1 Point (binnie.core.gui.geometry.Point)1 ControlItemDisplay (binnie.core.gui.minecraft.control.ControlItemDisplay)1 BlockETDecorativeLeaves (binnie.extratrees.blocks.BlockETDecorativeLeaves)1 IAlleleFruit (forestry.api.arboriculture.IAlleleFruit)1 IAlleleTreeSpecies (forestry.api.arboriculture.IAlleleTreeSpecies)1 IAllele (forestry.api.genetics.IAllele)1