Search in sources :

Example 1 with ILeafSpriteProvider

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

the class ModelDecorativeLeaves method bakeBlock.

@Override
protected void bakeBlock(BlockDecorativeLeaves block, TreeDefinition 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, BlockAbstractLeaves.FOLIAGE_COLOR_INDEX);
    // Render overlay for fruit leaves.
    ResourceLocation fruitSpriteLocation = genome.getFruitProvider().getDecorativeSprite();
    if (fruitSpriteLocation != null) {
        TextureAtlasSprite fruitSprite = map.getAtlasSprite(fruitSpriteLocation.toString());
        baker.addBlockModel(null, fruitSprite, BlockAbstractLeaves.FRUIT_COLOR_INDEX);
    }
    // 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 2 with ILeafSpriteProvider

use of forestry.api.arboriculture.ILeafSpriteProvider 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)

Example 3 with ILeafSpriteProvider

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

the class BlockDefaultLeaves method colorMultiplier.

@Override
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex) {
    TreeDefinition treeDefinition = getTreeDefinition(state);
    if (treeDefinition == null) {
        treeDefinition = TreeDefinition.Oak;
    }
    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)

Example 4 with ILeafSpriteProvider

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

the class ModelETDecorativeLeaves method bakeBlock.

@Override
protected void bakeBlock(BlockETDecorativeLeaves 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 5 with ILeafSpriteProvider

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

the class ModelDefaultLeaves method bakeBlock.

@Override
protected void bakeBlock(BlockDefaultLeaves block, TreeDefinition 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, BlockAbstractLeaves.FOLIAGE_COLOR_INDEX);
    // Render overlay for fruit leaves.
    ResourceLocation fruitSpriteLocation = genome.getFruitProvider().getDecorativeSprite();
    if (fruitSpriteLocation != null) {
        TextureAtlasSprite fruitSprite = map.getAtlasSprite(fruitSpriteLocation.toString());
        baker.addBlockModel(null, fruitSprite, BlockAbstractLeaves.FRUIT_COLOR_INDEX);
    }
    // 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)

Aggregations

ILeafSpriteProvider (forestry.api.arboriculture.ILeafSpriteProvider)7 ITreeGenome (forestry.api.arboriculture.ITreeGenome)7 IAlleleTreeSpecies (forestry.api.arboriculture.IAlleleTreeSpecies)5 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)5 TextureMap (net.minecraft.client.renderer.texture.TextureMap)5 ResourceLocation (net.minecraft.util.ResourceLocation)5 IFruitProvider (forestry.api.arboriculture.IFruitProvider)3 TreeDefinition (forestry.arboriculture.genetics.TreeDefinition)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 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 ITree (forestry.api.arboriculture.ITree)1 IAllele (forestry.api.genetics.IAllele)1 ArrayList (java.util.ArrayList)1 Minecraft (net.minecraft.client.Minecraft)1