Added multi pass rendering for berry bushes

This commit is contained in:
Adubbz 2013-09-21 19:58:14 +10:00
parent 637c9666c3
commit 2c394e2722
2 changed files with 19 additions and 1 deletions

View file

@ -40,6 +40,7 @@ public class BlockBOPFoliage extends BlockFlower implements IShearable
private Icon[] textures; private Icon[] textures;
public Icon shrubBranch; public Icon shrubBranch;
public Icon berryBushBerry;
private static final int GRASSTOP = 6; private static final int GRASSTOP = 6;
private static final int ALGAE = 0; private static final int ALGAE = 0;
@ -66,6 +67,7 @@ public class BlockBOPFoliage extends BlockFlower implements IShearable
} }
shrubBranch = iconRegister.registerIcon("biomesoplenty:" + "shrub_branch"); shrubBranch = iconRegister.registerIcon("biomesoplenty:" + "shrub_branch");
berryBushBerry = iconRegister.registerIcon("biomesoplenty:" + "berrybush_berry");
} }
@Override @Override

View file

@ -119,7 +119,7 @@ public class FoliageRenderer implements ISimpleBlockRenderingHandler
f3 = f6; f3 = f6;
} }
if (renderer.blockAccess.getBlockMetadata(par2, par3, par4) == 9 && renderer.blockAccess.getBlockId(par2, par3, par4) == Blocks.foliage.get().blockID) if ((renderer.blockAccess.getBlockMetadata(par2, par3, par4) == 8 || renderer.blockAccess.getBlockMetadata(par2, par3, par4) == 9) && renderer.blockAccess.getBlockId(par2, par3, par4) == Blocks.foliage.get().blockID)
{ {
tessellator.setColorOpaque_F(f, f, f); tessellator.setColorOpaque_F(f, f, f);
} }
@ -151,6 +151,10 @@ public class FoliageRenderer implements ISimpleBlockRenderingHandler
{ {
renderer.drawCrossedSquares(par1Block, renderer.blockAccess.getBlockMetadata(par2, par3, par4), d0, d1 - 1, d2, 1.0F); renderer.drawCrossedSquares(par1Block, renderer.blockAccess.getBlockMetadata(par2, par3, par4), d0, d1 - 1, d2, 1.0F);
} }
else if (renderer.blockAccess.getBlockMetadata(par2, par3, par4) == 8 && renderer.blockAccess.getBlockId(par2, par3, par4) == Blocks.foliage.get().blockID)
{
renderBerryBush(d0, d1, d2, 1.0F, f1, f2, f3, renderer);
}
else if (renderer.blockAccess.getBlockMetadata(par2, par3, par4) == 9 && renderer.blockAccess.getBlockId(par2, par3, par4) == Blocks.foliage.get().blockID) else if (renderer.blockAccess.getBlockMetadata(par2, par3, par4) == 9 && renderer.blockAccess.getBlockId(par2, par3, par4) == Blocks.foliage.get().blockID)
{ {
renderShrub(d0, d1, d2, 1.0F, f1, f2, f3, renderer); renderShrub(d0, d1, d2, 1.0F, f1, f2, f3, renderer);
@ -162,6 +166,18 @@ public class FoliageRenderer implements ISimpleBlockRenderingHandler
return true; return true;
} }
private static void renderBerryBush(double par1, double par2, double par3, float par4, float par5, float par6, float par7, RenderBlocks renderer)
{
Tessellator tessellator = Tessellator.instance;
Icon berryBush = renderer.getBlockIconFromSideAndMetadata(Blocks.foliage.get(), 0, 8);
Icon berryBushBerry = ((BlockBOPFoliage)Blocks.foliage.get()).berryBushBerry;
tessellator.setColorOpaque_F(par4 * par5, par4 * par6, par4 * par7);
renderCrossedSquaresFromIcon(berryBush, par1, par2, par3, par4, renderer);
tessellator.setColorOpaque_F(par4, par4, par4);
renderCrossedSquaresFromIcon(berryBushBerry, par1, par2, par3, par4, renderer);
}
private static void renderShrub(double par1, double par2, double par3, float par4, float par5, float par6, float par7, RenderBlocks renderer) private static void renderShrub(double par1, double par2, double par3, float par4, float par5, float par6, float par7, RenderBlocks renderer)
{ {
Tessellator tessellator = Tessellator.instance; Tessellator tessellator = Tessellator.instance;