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