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