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