Search in sources :

Example 26 with ITreeGenome

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

the class TreeBreedingSystem method onSyncBreedingTracker.

@Override
public void onSyncBreedingTracker(final IBreedingTracker tracker) {
    this.discoveredFruits.clear();
    this.discoveredWoods.clear();
    for (final IAlleleSpecies species : this.getDiscoveredSpecies(tracker)) {
        final IAlleleTreeSpecies tSpecies = (IAlleleTreeSpecies) species;
        final ITreeGenome genome = (ITreeGenome) this.getSpeciesRoot().templateAsGenome(this.getSpeciesRoot().getTemplate(tSpecies));
        IAlleleTreeSpecies treeSpecies = genome.getPrimary();
        final ItemStack wood = treeSpecies.getWoodProvider().getWoodStack();
        if (!wood.isEmpty()) {
            this.discoveredWoods.add(wood);
        }
        /*for (final ItemStack wood : tSpecies.getRoot().templateAsIndividual(getSpeciesRoot().getTemplate(tSpecies.getUID())).getProduceList()) {
				this.discoveredWoods.add(wood);
			}*/
        this.discoveredFruits.addAll(genome.getFruitProvider().getProducts().keySet());
    }
}
Also used : IAlleleTreeSpecies(forestry.api.arboriculture.IAlleleTreeSpecies) IAlleleSpecies(forestry.api.genetics.IAlleleSpecies) ItemStack(net.minecraft.item.ItemStack) ITreeGenome(forestry.api.arboriculture.ITreeGenome)

Example 27 with ITreeGenome

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

the class ModelDefaultETLeaves method bakeBlock.

@Override
protected void bakeBlock(BlockETDefaultLeaves block, ETTreeDefinition treeDefinition, IModelBaker baker, boolean inventory) {
    TextureMap map = Minecraft.getMinecraft().getTextureMapBlocks();
    ITreeGenome genome = treeDefinition.getGenome();
    IAlleleTreeSpecies species = genome.getPrimary();
    ILeafSpriteProvider leafSpriteProvider = species.getLeafSpriteProvider();
    ResourceLocation leafSpriteLocation = leafSpriteProvider.getSprite(false, Proxies.render.fancyGraphicsEnabled());
    TextureAtlasSprite leafSprite = map.getAtlasSprite(leafSpriteLocation.toString());
    // Render the plain leaf block.
    baker.addBlockModel(null, leafSprite, 0);
    // Render overlay for fruit leaves.
    ResourceLocation fruitSpriteLocation = genome.getFruitProvider().getDecorativeSprite();
    if (fruitSpriteLocation != null) {
        TextureAtlasSprite fruitSprite = map.getAtlasSprite(fruitSpriteLocation.toString());
        baker.addBlockModel(null, fruitSprite, 1);
    }
    // Set the particle sprite
    baker.setParticleSprite(leafSprite);
}
Also used : IAlleleTreeSpecies(forestry.api.arboriculture.IAlleleTreeSpecies) TextureMap(net.minecraft.client.renderer.texture.TextureMap) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) ResourceLocation(net.minecraft.util.ResourceLocation) ILeafSpriteProvider(forestry.api.arboriculture.ILeafSpriteProvider) ITreeGenome(forestry.api.arboriculture.ITreeGenome)

Example 28 with ITreeGenome

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

the class ItemBlockETDecorativeLeaves method getColorFromItemstack.

@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemstack(ItemStack itemStack, int renderPass) {
    int meta = itemStack.getMetadata();
    BlockETDecorativeLeaves block = getBlock();
    ETTreeDefinition treeDefinition = block.getTreeType(meta);
    if (treeDefinition == null) {
        return ModuleArboriculture.proxy.getFoliageColorBasic();
    }
    ITreeGenome genome = treeDefinition.getGenome();
    if (renderPass == 0) {
        return genome.getPrimary().getLeafSpriteProvider().getColor(false);
    } else {
        IFruitProvider fruitProvider = genome.getFruitProvider();
        return fruitProvider.getDecorativeColor();
    }
}
Also used : BlockETDecorativeLeaves(binnie.extratrees.blocks.BlockETDecorativeLeaves) ETTreeDefinition(binnie.extratrees.genetics.ETTreeDefinition) ITreeGenome(forestry.api.arboriculture.ITreeGenome) IFruitProvider(forestry.api.arboriculture.IFruitProvider) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

ITreeGenome (forestry.api.arboriculture.ITreeGenome)28 IAlleleTreeSpecies (forestry.api.arboriculture.IAlleleTreeSpecies)14 IFruitProvider (forestry.api.arboriculture.IFruitProvider)11 ItemStack (net.minecraft.item.ItemStack)9 ITree (forestry.api.arboriculture.ITree)8 ILeafSpriteProvider (forestry.api.arboriculture.ILeafSpriteProvider)7 IAlleleSpecies (forestry.api.genetics.IAlleleSpecies)6 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)6 ArrayList (java.util.ArrayList)5 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)5 TextureMap (net.minecraft.client.renderer.texture.TextureMap)5 ResourceLocation (net.minecraft.util.ResourceLocation)5 ETTreeDefinition (binnie.extratrees.genetics.ETTreeDefinition)3 TreeDefinition (forestry.arboriculture.genetics.TreeDefinition)3 IBreedingSystem (binnie.core.api.genetics.IBreedingSystem)2 ITreeMutation (forestry.api.arboriculture.ITreeMutation)2 IAllele (forestry.api.genetics.IAllele)2 IChromosome (forestry.api.genetics.IChromosome)2 ControlText (binnie.core.gui.controls.ControlText)1 Control (binnie.core.gui.controls.core.Control)1