Made Algae biome coloured
This commit is contained in:
parent
710b858561
commit
57038d833a
1 changed files with 54 additions and 1 deletions
|
@ -4,6 +4,7 @@ import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.EntityRenderer;
|
import net.minecraft.client.renderer.EntityRenderer;
|
||||||
import net.minecraft.client.renderer.RenderBlocks;
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.util.Icon;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import biomesoplenty.api.Blocks;
|
import biomesoplenty.api.Blocks;
|
||||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||||
|
@ -26,7 +27,7 @@ public class FoliageRenderer implements ISimpleBlockRenderingHandler
|
||||||
if (modelId == RenderUtils.foliageModel)
|
if (modelId == RenderUtils.foliageModel)
|
||||||
{
|
{
|
||||||
if (meta == 0)
|
if (meta == 0)
|
||||||
return renderer.renderBlockLilyPad(block, x, y, z);
|
return renderBlockAlgae(renderer, block, x, y, z);
|
||||||
else
|
else
|
||||||
return renderCrossedSquares(block, x, y, z, renderer);
|
return renderCrossedSquares(block, x, y, z, renderer);
|
||||||
}
|
}
|
||||||
|
@ -45,6 +46,58 @@ public class FoliageRenderer implements ISimpleBlockRenderingHandler
|
||||||
return RenderUtils.foliageModel;
|
return RenderUtils.foliageModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean renderBlockAlgae(RenderBlocks renderer, Block block, int x, int y, int z)
|
||||||
|
{
|
||||||
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
Icon icon = renderer.getBlockIconFromSide(block, 1);
|
||||||
|
|
||||||
|
if (renderer.hasOverrideBlockTexture())
|
||||||
|
{
|
||||||
|
icon = renderer.overrideBlockTexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
float cf = 1.0F;
|
||||||
|
int cl = block.colorMultiplier(renderer.blockAccess, x, y, z);
|
||||||
|
float c1 = (cl >> 16 & 255) / 255.0F;
|
||||||
|
float c2 = (cl >> 8 & 255) / 255.0F;
|
||||||
|
float c3 = (cl & 255) / 255.0F;
|
||||||
|
|
||||||
|
if (EntityRenderer.anaglyphEnable)
|
||||||
|
{
|
||||||
|
float f4 = (c1 * 30.0F + c2 * 59.0F + c3 * 11.0F) / 100.0F;
|
||||||
|
float f5 = (c1 * 30.0F + c2 * 70.0F) / 100.0F;
|
||||||
|
float f6 = (c1 * 30.0F + c3 * 70.0F) / 100.0F;
|
||||||
|
c1 = f4;
|
||||||
|
c2 = f5;
|
||||||
|
c3 = f6;
|
||||||
|
}
|
||||||
|
|
||||||
|
tessellator.setColorOpaque_F(cf * c1, cf * c2, cf * c3);
|
||||||
|
|
||||||
|
float f = 0.015625F;
|
||||||
|
double d0 = (double)icon.getMinU();
|
||||||
|
double d1 = (double)icon.getMinV();
|
||||||
|
double d2 = (double)icon.getMaxU();
|
||||||
|
double d3 = (double)icon.getMaxV();
|
||||||
|
long l = (long)(x * 3129871) ^ (long)z * 116129781L ^ (long)y;
|
||||||
|
l = l * l * 42317861L + l * 11L;
|
||||||
|
int i1 = (int)(l >> 16 & 3L);
|
||||||
|
tessellator.setBrightness(block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z));
|
||||||
|
float f1 = (float)x + 0.5F;
|
||||||
|
float f2 = (float)z + 0.5F;
|
||||||
|
float f3 = (float)(i1 & 1) * 0.5F * (float)(1 - i1 / 2 % 2 * 2);
|
||||||
|
float f4 = (float)(i1 + 1 & 1) * 0.5F * (float)(1 - (i1 + 1) / 2 % 2 * 2);
|
||||||
|
tessellator.addVertexWithUV((double)(f1 + f3 - f4), (double)((float)y + f), (double)(f2 + f3 + f4), d0, d1);
|
||||||
|
tessellator.addVertexWithUV((double)(f1 + f3 + f4), (double)((float)y + f), (double)(f2 - f3 + f4), d2, d1);
|
||||||
|
tessellator.addVertexWithUV((double)(f1 - f3 + f4), (double)((float)y + f), (double)(f2 - f3 - f4), d2, d3);
|
||||||
|
tessellator.addVertexWithUV((double)(f1 - f3 - f4), (double)((float)y + f), (double)(f2 + f3 - f4), d0, d3);
|
||||||
|
tessellator.addVertexWithUV((double)(f1 - f3 - f4), (double)((float)y + f), (double)(f2 + f3 - f4), d0, d3);
|
||||||
|
tessellator.addVertexWithUV((double)(f1 - f3 + f4), (double)((float)y + f), (double)(f2 - f3 - f4), d2, d3);
|
||||||
|
tessellator.addVertexWithUV((double)(f1 + f3 + f4), (double)((float)y + f), (double)(f2 - f3 + f4), d2, d1);
|
||||||
|
tessellator.addVertexWithUV((double)(f1 + f3 - f4), (double)((float)y + f), (double)(f2 + f3 + f4), d0, d1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean renderCrossedSquares(Block par1Block, int par2, int par3, int par4, RenderBlocks renderer)
|
private boolean renderCrossedSquares(Block par1Block, int par2, int par3, int par4, RenderBlocks renderer)
|
||||||
{
|
{
|
||||||
Tessellator tessellator = Tessellator.instance;
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
|
Loading…
Reference in a new issue