From f8dfc61c68eca5e5e60575ee0dfd60c24f13ea4d Mon Sep 17 00:00:00 2001 From: Adubbz G Date: Tue, 25 Jun 2013 18:53:40 +1000 Subject: [PATCH] Attempted adding puddles, big letdown is the fact that the water isn't transparent --- src/minecraft/biomesoplenty/ClientProxy.java | 2 + src/minecraft/biomesoplenty/api/Blocks.java | 1 + .../biomesoplenty/blocks/BlockPuddle.java | 114 ++ .../renderers/BlockSkinRenderHelper.java | 1688 +++++++++++++++++ .../blocks/renderers/PuddleRender.java | 89 + .../configuration/BOPBlocks.java | 6 +- .../configuration/BOPConfiguration.java | 4 + 7 files changed, 1902 insertions(+), 2 deletions(-) create mode 100644 src/minecraft/biomesoplenty/blocks/BlockPuddle.java create mode 100644 src/minecraft/biomesoplenty/blocks/renderers/BlockSkinRenderHelper.java create mode 100644 src/minecraft/biomesoplenty/blocks/renderers/PuddleRender.java diff --git a/src/minecraft/biomesoplenty/ClientProxy.java b/src/minecraft/biomesoplenty/ClientProxy.java index 4b684f66e..00aa098eb 100644 --- a/src/minecraft/biomesoplenty/ClientProxy.java +++ b/src/minecraft/biomesoplenty/ClientProxy.java @@ -17,6 +17,7 @@ import biomesoplenty.api.Items; import biomesoplenty.blocks.renderers.AltarRenderer; import biomesoplenty.blocks.renderers.FoliageRenderer; import biomesoplenty.blocks.renderers.PlantsRenderer; +import biomesoplenty.blocks.renderers.PuddleRender; import biomesoplenty.blocks.renderers.RenderUtils; import biomesoplenty.blocks.renderers.SmallBlockRenderer; import biomesoplenty.entities.EntityGlob; @@ -47,6 +48,7 @@ public class ClientProxy extends CommonProxy { RenderingRegistry.registerBlockHandler(new PlantsRenderer()); RenderingRegistry.registerBlockHandler(new SmallBlockRenderer()); RenderingRegistry.registerBlockHandler(new AltarRenderer()); + RenderingRegistry.registerBlockHandler(new PuddleRender()); //TODO: Remove upon Fluid API being integrated into Forge FluidRegistry.renderIdFluid = RenderingRegistry.getNextAvailableRenderId(); diff --git a/src/minecraft/biomesoplenty/api/Blocks.java b/src/minecraft/biomesoplenty/api/Blocks.java index be0223bbc..a0aaf6a91 100644 --- a/src/minecraft/biomesoplenty/api/Blocks.java +++ b/src/minecraft/biomesoplenty/api/Blocks.java @@ -96,6 +96,7 @@ public class Blocks public static Optional promisedPortal = Optional.absent(); public static Optional glass = Optional.absent(); public static Optional altar = Optional.absent(); + public static Optional puddle = Optional.absent(); /** * Populated by Biomes O Plenty with default Biomes O Plenty leaves. Add additional leaves here (E.g. "Blocks.shearBlockIds.put(acaciaLeaves.blockID, 15.0F);") diff --git a/src/minecraft/biomesoplenty/blocks/BlockPuddle.java b/src/minecraft/biomesoplenty/blocks/BlockPuddle.java new file mode 100644 index 000000000..558e6fd9e --- /dev/null +++ b/src/minecraft/biomesoplenty/blocks/BlockPuddle.java @@ -0,0 +1,114 @@ +package biomesoplenty.blocks; + +import java.util.Random; + +import biomesoplenty.BiomesOPlenty; +import biomesoplenty.blocks.renderers.PuddleRender; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.Icon; +import net.minecraft.world.World; +import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.IPlantable; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockPuddle extends Block +{ + @SideOnly(Side.CLIENT) + private Icon field_94441_a; + @SideOnly(Side.CLIENT) + private Icon field_94440_b; + + public BlockPuddle(int par1) + { + super(par1, Material.ground); + this.setTickRandomly(true); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.8135F, 1.0F); + this.setLightOpacity(0); + this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return AxisAlignedBB.getAABBPool().getAABB((double)(par2 + 0), (double)(par3 + 0), (double)(par4 + 0), (double)(par2 + 1), (double)(par3 + 0.8135F), (double)(par4 + 1)); + } + + public boolean isOpaqueCube() + { + return false; + } + + public boolean renderAsNormalBlock() + { + return false; + } + + public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) + { + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, 1); + + return par9; + } + + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + Material material1 = par1World.getBlockMaterial(par2 + 1, par3, par4); + Material material2 = par1World.getBlockMaterial(par2 - 1, par3, par4); + Material material3 = par1World.getBlockMaterial(par2, par3, par4 + 1); + Material material4 = par1World.getBlockMaterial(par2, par3, par4 - 1); + + if (!material1.isSolid() || !material2.isSolid() || !material3.isSolid() || !material1.isSolid()) + { + par1World.setBlock(par2, par3, par4, Block.dirt.blockID); + } + } + + @Override + public int getRenderType() + { + return PuddleRender.puddleID; + } + + @SideOnly(Side.CLIENT) + + public Icon getIcon(int par1, int par2) + { + return Block.dirt.getBlockTextureFromSide(par1); + } + + + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + super.onNeighborBlockChange(par1World, par2, par3, par4, par5); + Material material = par1World.getBlockMaterial(par2, par3 + 1, par4); + + if (material.isSolid()) + { + par1World.setBlock(par2, par3, par4, Block.dirt.blockID); + } + + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, 1); + } + + public int idDropped(int par1, Random par2Random, int par3) + { + return Block.dirt.idDropped(0, par2Random, par3); + } + + @SideOnly(Side.CLIENT) + public int idPicked(World par1World, int par2, int par3, int par4) + { + return Block.dirt.blockID; + } + + @SideOnly(Side.CLIENT) + public void registerIcons(IconRegister par1IconRegister) + { + } +} diff --git a/src/minecraft/biomesoplenty/blocks/renderers/BlockSkinRenderHelper.java b/src/minecraft/biomesoplenty/blocks/renderers/BlockSkinRenderHelper.java new file mode 100644 index 000000000..72fcb1456 --- /dev/null +++ b/src/minecraft/biomesoplenty/blocks/renderers/BlockSkinRenderHelper.java @@ -0,0 +1,1688 @@ +package biomesoplenty.blocks.renderers; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockGrass; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.Icon; +import net.minecraft.world.IBlockAccess; + +public class BlockSkinRenderHelper +{ + public static boolean renderMetadataBlock (Block block, int metadata, int x, int y, int z, RenderBlocks renderer, IBlockAccess world) + { + int var5 = block.colorMultiplier(world, x, y, z); + float var6 = (float) (var5 >> 16 & 255) / 255.0F; + float var7 = (float) (var5 >> 8 & 255) / 255.0F; + float var8 = (float) (var5 & 255) / 255.0F; + + if (EntityRenderer.anaglyphEnable) + { + float var9 = (var6 * 30.0F + var7 * 59.0F + var8 * 11.0F) / 100.0F; + float var10 = (var6 * 30.0F + var7 * 70.0F) / 100.0F; + float var11 = (var6 * 30.0F + var8 * 70.0F) / 100.0F; + var6 = var9; + var7 = var10; + var8 = var11; + } + + return Minecraft.isAmbientOcclusionEnabled() && Block.lightValue[block.blockID] == 0 ? + renderMetadataBlockWithAmbientOcclusion(block, metadata, x, y, z, var6, var7, var8, renderer, world) + : renderMetadataBlockWithColorMultiplier(block, metadata, x, y, z, var6, var7, var8, renderer, world); + } + + static boolean renderMetadataBlockWithAmbientOcclusion(Block block, int metadata, int xPos, int yPos, int zPos, + float colorRed, float colorGreen, float colorBlue, RenderBlocks render, IBlockAccess world) + { + render.enableAO = true; + boolean flag = false; + float f3 = 0.0F; + float f4 = 0.0F; + float f5 = 0.0F; + float f6 = 0.0F; + boolean flag1 = true; + int l = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos); + Tessellator tessellator = Tessellator.instance; + tessellator.setBrightness(983055); + + if (render.getBlockIcon(block).getIconName().equals("grass_top")) + { + flag1 = false; + } + else if (render.hasOverrideBlockTexture()) + { + flag1 = false; + } + + boolean flag2; + boolean flag3; + boolean flag4; + boolean flag5; + float f7; + int i1; + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos, yPos - 1, zPos, 0)) + { + if (render.renderMinY <= 0.0D) + { + --yPos; + } + + render.aoBrightnessXYNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos); + render.aoBrightnessYZNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos - 1); + render.aoBrightnessYZNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos + 1); + render.aoBrightnessXYPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos); + render.aoLightValueScratchXYNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos, zPos); + render.aoLightValueScratchYZNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos, zPos - 1); + render.aoLightValueScratchYZNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos, zPos + 1); + render.aoLightValueScratchXYPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos, zPos); + flag3 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos + 1, yPos - 1, zPos)]; + flag2 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos - 1, yPos - 1, zPos)]; + flag5 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos, yPos - 1, zPos + 1)]; + flag4 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos, yPos - 1, zPos - 1)]; + + if (!flag4 && !flag2) + { + render.aoLightValueScratchXYZNNN = render.aoLightValueScratchXYNN; + render.aoBrightnessXYZNNN = render.aoBrightnessXYNN; + } + else + { + render.aoLightValueScratchXYZNNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos, zPos - 1); + render.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos - 1); + } + + if (!flag5 && !flag2) + { + render.aoLightValueScratchXYZNNP = render.aoLightValueScratchXYNN; + render.aoBrightnessXYZNNP = render.aoBrightnessXYNN; + } + else + { + render.aoLightValueScratchXYZNNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos, zPos + 1); + render.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos + 1); + } + + if (!flag4 && !flag3) + { + render.aoLightValueScratchXYZPNN = render.aoLightValueScratchXYPN; + render.aoBrightnessXYZPNN = render.aoBrightnessXYPN; + } + else + { + render.aoLightValueScratchXYZPNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos, zPos - 1); + render.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos - 1); + } + + if (!flag5 && !flag3) + { + render.aoLightValueScratchXYZPNP = render.aoLightValueScratchXYPN; + render.aoBrightnessXYZPNP = render.aoBrightnessXYPN; + } + else + { + render.aoLightValueScratchXYZPNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos, zPos + 1); + render.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos + 1); + } + + if (render.renderMinY <= 0.0D) + { + ++yPos; + } + + i1 = l; + + if (render.renderMinY <= 0.0D || !render.blockAccess.isBlockOpaqueCube(xPos, yPos - 1, zPos)) + { + i1 = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos); + } + + f7 = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos - 1, zPos); + f3 = (render.aoLightValueScratchXYZNNP + render.aoLightValueScratchXYNN + render.aoLightValueScratchYZNP + f7) / 4.0F; + f6 = (render.aoLightValueScratchYZNP + f7 + render.aoLightValueScratchXYZPNP + render.aoLightValueScratchXYPN) / 4.0F; + f5 = (f7 + render.aoLightValueScratchYZNN + render.aoLightValueScratchXYPN + render.aoLightValueScratchXYZPNN) / 4.0F; + f4 = (render.aoLightValueScratchXYNN + render.aoLightValueScratchXYZNNN + f7 + render.aoLightValueScratchYZNN) / 4.0F; + render.brightnessTopLeft = render.getAoBrightness(render.aoBrightnessXYZNNP, render.aoBrightnessXYNN, render.aoBrightnessYZNP, i1); + render.brightnessTopRight = render.getAoBrightness(render.aoBrightnessYZNP, render.aoBrightnessXYZPNP, render.aoBrightnessXYPN, i1); + render.brightnessBottomRight = render.getAoBrightness(render.aoBrightnessYZNN, render.aoBrightnessXYPN, render.aoBrightnessXYZPNN, i1); + render.brightnessBottomLeft = render.getAoBrightness(render.aoBrightnessXYNN, render.aoBrightnessXYZNNN, render.aoBrightnessYZNN, i1); + + if (flag1) + { + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = colorRed * 0.5F; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = colorGreen * 0.5F; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = colorBlue * 0.5F; + } + else + { + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = 0.5F; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = 0.5F; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = 0.5F; + } + + render.colorRedTopLeft *= f3; + render.colorGreenTopLeft *= f3; + render.colorBlueTopLeft *= f3; + render.colorRedBottomLeft *= f4; + render.colorGreenBottomLeft *= f4; + render.colorBlueBottomLeft *= f4; + render.colorRedBottomRight *= f5; + render.colorGreenBottomRight *= f5; + render.colorBlueBottomRight *= f5; + render.colorRedTopRight *= f6; + render.colorGreenTopRight *= f6; + render.colorBlueTopRight *= f6; + render.renderFaceYNeg(block, (double)xPos, (double)yPos, (double)zPos, block.getIcon(0, metadata)); + flag = true; + } + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos, yPos + 1, zPos, 1)) + { + if (render.renderMaxY >= 1.0D) + { + ++yPos; + } + + render.aoBrightnessXYNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos); + render.aoBrightnessXYPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos); + render.aoBrightnessYZPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos - 1); + render.aoBrightnessYZPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos + 1); + render.aoLightValueScratchXYNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos, zPos); + render.aoLightValueScratchXYPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos, zPos); + render.aoLightValueScratchYZPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos, zPos - 1); + render.aoLightValueScratchYZPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos, zPos + 1); + flag3 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos + 1, yPos + 1, zPos)]; + flag2 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos - 1, yPos + 1, zPos)]; + flag5 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos, yPos + 1, zPos + 1)]; + flag4 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos, yPos + 1, zPos - 1)]; + + if (!flag4 && !flag2) + { + render.aoLightValueScratchXYZNPN = render.aoLightValueScratchXYNP; + render.aoBrightnessXYZNPN = render.aoBrightnessXYNP; + } + else + { + render.aoLightValueScratchXYZNPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos, zPos - 1); + render.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos - 1); + } + + if (!flag4 && !flag3) + { + render.aoLightValueScratchXYZPPN = render.aoLightValueScratchXYPP; + render.aoBrightnessXYZPPN = render.aoBrightnessXYPP; + } + else + { + render.aoLightValueScratchXYZPPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos, zPos - 1); + render.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos - 1); + } + + if (!flag5 && !flag2) + { + render.aoLightValueScratchXYZNPP = render.aoLightValueScratchXYNP; + render.aoBrightnessXYZNPP = render.aoBrightnessXYNP; + } + else + { + render.aoLightValueScratchXYZNPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos, zPos + 1); + render.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos + 1); + } + + if (!flag5 && !flag3) + { + render.aoLightValueScratchXYZPPP = render.aoLightValueScratchXYPP; + render.aoBrightnessXYZPPP = render.aoBrightnessXYPP; + } + else + { + render.aoLightValueScratchXYZPPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos, zPos + 1); + render.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos + 1); + } + + if (render.renderMaxY >= 1.0D) + { + --yPos; + } + + i1 = l; + + if (render.renderMaxY >= 1.0D || !render.blockAccess.isBlockOpaqueCube(xPos, yPos + 1, zPos)) + { + i1 = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos); + } + + f7 = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos + 1, zPos); + f6 = (render.aoLightValueScratchXYZNPP + render.aoLightValueScratchXYNP + render.aoLightValueScratchYZPP + f7) / 4.0F; + f3 = (render.aoLightValueScratchYZPP + f7 + render.aoLightValueScratchXYZPPP + render.aoLightValueScratchXYPP) / 4.0F; + f4 = (f7 + render.aoLightValueScratchYZPN + render.aoLightValueScratchXYPP + render.aoLightValueScratchXYZPPN) / 4.0F; + f5 = (render.aoLightValueScratchXYNP + render.aoLightValueScratchXYZNPN + f7 + render.aoLightValueScratchYZPN) / 4.0F; + render.brightnessTopRight = render.getAoBrightness(render.aoBrightnessXYZNPP, render.aoBrightnessXYNP, render.aoBrightnessYZPP, i1); + render.brightnessTopLeft = render.getAoBrightness(render.aoBrightnessYZPP, render.aoBrightnessXYZPPP, render.aoBrightnessXYPP, i1); + render.brightnessBottomLeft = render.getAoBrightness(render.aoBrightnessYZPN, render.aoBrightnessXYPP, render.aoBrightnessXYZPPN, i1); + render.brightnessBottomRight = render.getAoBrightness(render.aoBrightnessXYNP, render.aoBrightnessXYZNPN, render.aoBrightnessYZPN, i1); + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = colorRed; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = colorGreen; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = colorBlue; + render.colorRedTopLeft *= f3; + render.colorGreenTopLeft *= f3; + render.colorBlueTopLeft *= f3; + render.colorRedBottomLeft *= f4; + render.colorGreenBottomLeft *= f4; + render.colorBlueBottomLeft *= f4; + render.colorRedBottomRight *= f5; + render.colorGreenBottomRight *= f5; + render.colorBlueBottomRight *= f5; + render.colorRedTopRight *= f6; + render.colorGreenTopRight *= f6; + render.colorBlueTopRight *= f6; + render.renderFaceYPos(block, (double)xPos, (double)yPos, (double)zPos, block.getIcon(1, metadata)); + flag = true; + } + + Icon icon; + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos, yPos, zPos - 1, 2)) + { + if (render.renderMinZ <= 0.0D) + { + --zPos; + } + + render.aoLightValueScratchXZNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos, zPos); + render.aoLightValueScratchYZNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos - 1, zPos); + render.aoLightValueScratchYZPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos + 1, zPos); + render.aoLightValueScratchXZPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos, zPos); + render.aoBrightnessXZNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos); + render.aoBrightnessYZNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos); + render.aoBrightnessYZPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos); + render.aoBrightnessXZPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos); + flag3 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos + 1, yPos, zPos - 1)]; + flag2 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos - 1, yPos, zPos - 1)]; + flag5 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos, yPos + 1, zPos - 1)]; + flag4 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos, yPos - 1, zPos - 1)]; + + if (!flag2 && !flag4) + { + render.aoLightValueScratchXYZNNN = render.aoLightValueScratchXZNN; + render.aoBrightnessXYZNNN = render.aoBrightnessXZNN; + } + else + { + render.aoLightValueScratchXYZNNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos - 1, zPos); + render.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos - 1, zPos); + } + + if (!flag2 && !flag5) + { + render.aoLightValueScratchXYZNPN = render.aoLightValueScratchXZNN; + render.aoBrightnessXYZNPN = render.aoBrightnessXZNN; + } + else + { + render.aoLightValueScratchXYZNPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos + 1, zPos); + render.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos + 1, zPos); + } + + if (!flag3 && !flag4) + { + render.aoLightValueScratchXYZPNN = render.aoLightValueScratchXZPN; + render.aoBrightnessXYZPNN = render.aoBrightnessXZPN; + } + else + { + render.aoLightValueScratchXYZPNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos - 1, zPos); + render.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos - 1, zPos); + } + + if (!flag3 && !flag5) + { + render.aoLightValueScratchXYZPPN = render.aoLightValueScratchXZPN; + render.aoBrightnessXYZPPN = render.aoBrightnessXZPN; + } + else + { + render.aoLightValueScratchXYZPPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos + 1, zPos); + render.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos + 1, zPos); + } + + if (render.renderMinZ <= 0.0D) + { + ++zPos; + } + + i1 = l; + + if (render.renderMinZ <= 0.0D || !render.blockAccess.isBlockOpaqueCube(xPos, yPos, zPos - 1)) + { + i1 = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos - 1); + } + + f7 = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos, zPos - 1); + f3 = (render.aoLightValueScratchXZNN + render.aoLightValueScratchXYZNPN + f7 + render.aoLightValueScratchYZPN) / 4.0F; + f4 = (f7 + render.aoLightValueScratchYZPN + render.aoLightValueScratchXZPN + render.aoLightValueScratchXYZPPN) / 4.0F; + f5 = (render.aoLightValueScratchYZNN + f7 + render.aoLightValueScratchXYZPNN + render.aoLightValueScratchXZPN) / 4.0F; + f6 = (render.aoLightValueScratchXYZNNN + render.aoLightValueScratchXZNN + render.aoLightValueScratchYZNN + f7) / 4.0F; + render.brightnessTopLeft = render.getAoBrightness(render.aoBrightnessXZNN, render.aoBrightnessXYZNPN, render.aoBrightnessYZPN, i1); + render.brightnessBottomLeft = render.getAoBrightness(render.aoBrightnessYZPN, render.aoBrightnessXZPN, render.aoBrightnessXYZPPN, i1); + render.brightnessBottomRight = render.getAoBrightness(render.aoBrightnessYZNN, render.aoBrightnessXYZPNN, render.aoBrightnessXZPN, i1); + render.brightnessTopRight = render.getAoBrightness(render.aoBrightnessXYZNNN, render.aoBrightnessXZNN, render.aoBrightnessYZNN, i1); + + if (flag1) + { + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = colorRed * 0.8F; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = colorGreen * 0.8F; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = colorBlue * 0.8F; + } + else + { + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = 0.8F; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = 0.8F; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = 0.8F; + } + + render.colorRedTopLeft *= f3; + render.colorGreenTopLeft *= f3; + render.colorBlueTopLeft *= f3; + render.colorRedBottomLeft *= f4; + render.colorGreenBottomLeft *= f4; + render.colorBlueBottomLeft *= f4; + render.colorRedBottomRight *= f5; + render.colorGreenBottomRight *= f5; + render.colorBlueBottomRight *= f5; + render.colorRedTopRight *= f6; + render.colorGreenTopRight *= f6; + render.colorBlueTopRight *= f6; + icon = block.getIcon(2, metadata); + render.renderFaceZNeg(block, (double)xPos, (double)yPos, (double)zPos, icon); + + flag = true; + } + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos, yPos, zPos + 1, 3)) + { + if (render.renderMaxZ >= 1.0D) + { + ++zPos; + } + + render.aoLightValueScratchXZNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos, zPos); + render.aoLightValueScratchXZPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos, zPos); + render.aoLightValueScratchYZNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos - 1, zPos); + render.aoLightValueScratchYZPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos + 1, zPos); + render.aoBrightnessXZNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos); + render.aoBrightnessXZPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos); + render.aoBrightnessYZNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos); + render.aoBrightnessYZPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos); + flag3 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos + 1, yPos, zPos + 1)]; + flag2 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos - 1, yPos, zPos + 1)]; + flag5 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos, yPos + 1, zPos + 1)]; + flag4 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos, yPos - 1, zPos + 1)]; + + if (!flag2 && !flag4) + { + render.aoLightValueScratchXYZNNP = render.aoLightValueScratchXZNP; + render.aoBrightnessXYZNNP = render.aoBrightnessXZNP; + } + else + { + render.aoLightValueScratchXYZNNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos - 1, zPos); + render.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos - 1, zPos); + } + + if (!flag2 && !flag5) + { + render.aoLightValueScratchXYZNPP = render.aoLightValueScratchXZNP; + render.aoBrightnessXYZNPP = render.aoBrightnessXZNP; + } + else + { + render.aoLightValueScratchXYZNPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos + 1, zPos); + render.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos + 1, zPos); + } + + if (!flag3 && !flag4) + { + render.aoLightValueScratchXYZPNP = render.aoLightValueScratchXZPP; + render.aoBrightnessXYZPNP = render.aoBrightnessXZPP; + } + else + { + render.aoLightValueScratchXYZPNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos - 1, zPos); + render.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos - 1, zPos); + } + + if (!flag3 && !flag5) + { + render.aoLightValueScratchXYZPPP = render.aoLightValueScratchXZPP; + render.aoBrightnessXYZPPP = render.aoBrightnessXZPP; + } + else + { + render.aoLightValueScratchXYZPPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos + 1, zPos); + render.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos + 1, zPos); + } + + if (render.renderMaxZ >= 1.0D) + { + --zPos; + } + + i1 = l; + + if (render.renderMaxZ >= 1.0D || !render.blockAccess.isBlockOpaqueCube(xPos, yPos, zPos + 1)) + { + i1 = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos + 1); + } + + f7 = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos, zPos + 1); + f3 = (render.aoLightValueScratchXZNP + render.aoLightValueScratchXYZNPP + f7 + render.aoLightValueScratchYZPP) / 4.0F; + f6 = (f7 + render.aoLightValueScratchYZPP + render.aoLightValueScratchXZPP + render.aoLightValueScratchXYZPPP) / 4.0F; + f5 = (render.aoLightValueScratchYZNP + f7 + render.aoLightValueScratchXYZPNP + render.aoLightValueScratchXZPP) / 4.0F; + f4 = (render.aoLightValueScratchXYZNNP + render.aoLightValueScratchXZNP + render.aoLightValueScratchYZNP + f7) / 4.0F; + render.brightnessTopLeft = render.getAoBrightness(render.aoBrightnessXZNP, render.aoBrightnessXYZNPP, render.aoBrightnessYZPP, i1); + render.brightnessTopRight = render.getAoBrightness(render.aoBrightnessYZPP, render.aoBrightnessXZPP, render.aoBrightnessXYZPPP, i1); + render.brightnessBottomRight = render.getAoBrightness(render.aoBrightnessYZNP, render.aoBrightnessXYZPNP, render.aoBrightnessXZPP, i1); + render.brightnessBottomLeft = render.getAoBrightness(render.aoBrightnessXYZNNP, render.aoBrightnessXZNP, render.aoBrightnessYZNP, i1); + + if (flag1) + { + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = colorRed * 0.8F; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = colorGreen * 0.8F; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = colorBlue * 0.8F; + } + else + { + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = 0.8F; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = 0.8F; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = 0.8F; + } + + render.colorRedTopLeft *= f3; + render.colorGreenTopLeft *= f3; + render.colorBlueTopLeft *= f3; + render.colorRedBottomLeft *= f4; + render.colorGreenBottomLeft *= f4; + render.colorBlueBottomLeft *= f4; + render.colorRedBottomRight *= f5; + render.colorGreenBottomRight *= f5; + render.colorBlueBottomRight *= f5; + render.colorRedTopRight *= f6; + render.colorGreenTopRight *= f6; + render.colorBlueTopRight *= f6; + icon = block.getIcon(3, metadata); + render.renderFaceZPos(block, (double)xPos, (double)yPos, (double)zPos, icon); + + flag = true; + } + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos - 1, yPos, zPos, 4)) + { + if (render.renderMinX <= 0.0D) + { + --xPos; + } + + render.aoLightValueScratchXYNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos - 1, zPos); + render.aoLightValueScratchXZNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos, zPos - 1); + render.aoLightValueScratchXZNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos, zPos + 1); + render.aoLightValueScratchXYNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos + 1, zPos); + render.aoBrightnessXYNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos); + render.aoBrightnessXZNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos - 1); + render.aoBrightnessXZNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos + 1); + render.aoBrightnessXYNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos); + flag3 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos - 1, yPos + 1, zPos)]; + flag2 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos - 1, yPos - 1, zPos)]; + flag5 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos - 1, yPos, zPos - 1)]; + flag4 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos - 1, yPos, zPos + 1)]; + + if (!flag5 && !flag2) + { + render.aoLightValueScratchXYZNNN = render.aoLightValueScratchXZNN; + render.aoBrightnessXYZNNN = render.aoBrightnessXZNN; + } + else + { + render.aoLightValueScratchXYZNNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos - 1, zPos - 1); + render.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos - 1); + } + + if (!flag4 && !flag2) + { + render.aoLightValueScratchXYZNNP = render.aoLightValueScratchXZNP; + render.aoBrightnessXYZNNP = render.aoBrightnessXZNP; + } + else + { + render.aoLightValueScratchXYZNNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos - 1, zPos + 1); + render.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos + 1); + } + + if (!flag5 && !flag3) + { + render.aoLightValueScratchXYZNPN = render.aoLightValueScratchXZNN; + render.aoBrightnessXYZNPN = render.aoBrightnessXZNN; + } + else + { + render.aoLightValueScratchXYZNPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos + 1, zPos - 1); + render.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos - 1); + } + + if (!flag4 && !flag3) + { + render.aoLightValueScratchXYZNPP = render.aoLightValueScratchXZNP; + render.aoBrightnessXYZNPP = render.aoBrightnessXZNP; + } + else + { + render.aoLightValueScratchXYZNPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos + 1, zPos + 1); + render.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos + 1); + } + + if (render.renderMinX <= 0.0D) + { + ++xPos; + } + + i1 = l; + + if (render.renderMinX <= 0.0D || !render.blockAccess.isBlockOpaqueCube(xPos - 1, yPos, zPos)) + { + i1 = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos); + } + + f7 = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos, zPos); + f6 = (render.aoLightValueScratchXYNN + render.aoLightValueScratchXYZNNP + f7 + render.aoLightValueScratchXZNP) / 4.0F; + f3 = (f7 + render.aoLightValueScratchXZNP + render.aoLightValueScratchXYNP + render.aoLightValueScratchXYZNPP) / 4.0F; + f4 = (render.aoLightValueScratchXZNN + f7 + render.aoLightValueScratchXYZNPN + render.aoLightValueScratchXYNP) / 4.0F; + f5 = (render.aoLightValueScratchXYZNNN + render.aoLightValueScratchXYNN + render.aoLightValueScratchXZNN + f7) / 4.0F; + render.brightnessTopRight = render.getAoBrightness(render.aoBrightnessXYNN, render.aoBrightnessXYZNNP, render.aoBrightnessXZNP, i1); + render.brightnessTopLeft = render.getAoBrightness(render.aoBrightnessXZNP, render.aoBrightnessXYNP, render.aoBrightnessXYZNPP, i1); + render.brightnessBottomLeft = render.getAoBrightness(render.aoBrightnessXZNN, render.aoBrightnessXYZNPN, render.aoBrightnessXYNP, i1); + render.brightnessBottomRight = render.getAoBrightness(render.aoBrightnessXYZNNN, render.aoBrightnessXYNN, render.aoBrightnessXZNN, i1); + + if (flag1) + { + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = colorRed * 0.6F; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = colorGreen * 0.6F; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = colorBlue * 0.6F; + } + else + { + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = 0.6F; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = 0.6F; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = 0.6F; + } + + render.colorRedTopLeft *= f3; + render.colorGreenTopLeft *= f3; + render.colorBlueTopLeft *= f3; + render.colorRedBottomLeft *= f4; + render.colorGreenBottomLeft *= f4; + render.colorBlueBottomLeft *= f4; + render.colorRedBottomRight *= f5; + render.colorGreenBottomRight *= f5; + render.colorBlueBottomRight *= f5; + render.colorRedTopRight *= f6; + render.colorGreenTopRight *= f6; + render.colorBlueTopRight *= f6; + icon = block.getIcon(4, metadata); + render.renderFaceXNeg(block, (double)xPos, (double)yPos, (double)zPos, icon); + + flag = true; + } + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos + 1, yPos, zPos, 5)) + { + if (render.renderMaxX >= 1.0D) + { + ++xPos; + } + + render.aoLightValueScratchXYPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos - 1, zPos); + render.aoLightValueScratchXZPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos, zPos - 1); + render.aoLightValueScratchXZPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos, zPos + 1); + render.aoLightValueScratchXYPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos + 1, zPos); + render.aoBrightnessXYPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos); + render.aoBrightnessXZPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos - 1); + render.aoBrightnessXZPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos + 1); + render.aoBrightnessXYPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos); + flag3 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos + 1, yPos + 1, zPos)]; + flag2 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos + 1, yPos - 1, zPos)]; + flag5 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos + 1, yPos, zPos + 1)]; + flag4 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos + 1, yPos, zPos - 1)]; + + if (!flag2 && !flag4) + { + render.aoLightValueScratchXYZPNN = render.aoLightValueScratchXZPN; + render.aoBrightnessXYZPNN = render.aoBrightnessXZPN; + } + else + { + render.aoLightValueScratchXYZPNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos - 1, zPos - 1); + render.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos - 1); + } + + if (!flag2 && !flag5) + { + render.aoLightValueScratchXYZPNP = render.aoLightValueScratchXZPP; + render.aoBrightnessXYZPNP = render.aoBrightnessXZPP; + } + else + { + render.aoLightValueScratchXYZPNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos - 1, zPos + 1); + render.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos + 1); + } + + if (!flag3 && !flag4) + { + render.aoLightValueScratchXYZPPN = render.aoLightValueScratchXZPN; + render.aoBrightnessXYZPPN = render.aoBrightnessXZPN; + } + else + { + render.aoLightValueScratchXYZPPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos + 1, zPos - 1); + render.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos - 1); + } + + if (!flag3 && !flag5) + { + render.aoLightValueScratchXYZPPP = render.aoLightValueScratchXZPP; + render.aoBrightnessXYZPPP = render.aoBrightnessXZPP; + } + else + { + render.aoLightValueScratchXYZPPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos + 1, zPos + 1); + render.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos + 1); + } + + if (render.renderMaxX >= 1.0D) + { + --xPos; + } + + i1 = l; + + if (render.renderMaxX >= 1.0D || !render.blockAccess.isBlockOpaqueCube(xPos + 1, yPos, zPos)) + { + i1 = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos); + } + + f7 = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos, zPos); + f3 = (render.aoLightValueScratchXYPN + render.aoLightValueScratchXYZPNP + f7 + render.aoLightValueScratchXZPP) / 4.0F; + f4 = (render.aoLightValueScratchXYZPNN + render.aoLightValueScratchXYPN + render.aoLightValueScratchXZPN + f7) / 4.0F; + f5 = (render.aoLightValueScratchXZPN + f7 + render.aoLightValueScratchXYZPPN + render.aoLightValueScratchXYPP) / 4.0F; + f6 = (f7 + render.aoLightValueScratchXZPP + render.aoLightValueScratchXYPP + render.aoLightValueScratchXYZPPP) / 4.0F; + render.brightnessTopLeft = render.getAoBrightness(render.aoBrightnessXYPN, render.aoBrightnessXYZPNP, render.aoBrightnessXZPP, i1); + render.brightnessTopRight = render.getAoBrightness(render.aoBrightnessXZPP, render.aoBrightnessXYPP, render.aoBrightnessXYZPPP, i1); + render.brightnessBottomRight = render.getAoBrightness(render.aoBrightnessXZPN, render.aoBrightnessXYZPPN, render.aoBrightnessXYPP, i1); + render.brightnessBottomLeft = render.getAoBrightness(render.aoBrightnessXYZPNN, render.aoBrightnessXYPN, render.aoBrightnessXZPN, i1); + + if (flag1) + { + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = colorRed * 0.6F; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = colorGreen * 0.6F; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = colorBlue * 0.6F; + } + else + { + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = 0.6F; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = 0.6F; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = 0.6F; + } + + render.colorRedTopLeft *= f3; + render.colorGreenTopLeft *= f3; + render.colorBlueTopLeft *= f3; + render.colorRedBottomLeft *= f4; + render.colorGreenBottomLeft *= f4; + render.colorBlueBottomLeft *= f4; + render.colorRedBottomRight *= f5; + render.colorGreenBottomRight *= f5; + render.colorBlueBottomRight *= f5; + render.colorRedTopRight *= f6; + render.colorGreenTopRight *= f6; + render.colorBlueTopRight *= f6; + icon = block.getIcon(5, metadata); + render.renderFaceXPos(block, (double)xPos, (double)yPos, (double)zPos, icon); + + flag = true; + } + + render.enableAO = false; + return flag; + } + + static boolean renderMetadataBlockWithColorMultiplier(Block block, int metadata, int xPos, int yPos, int zPos, float colorRed, float colorGreen, float colorBlue, RenderBlocks render, IBlockAccess world) + { + render.enableAO = false; + Tessellator tessellator = Tessellator.instance; + boolean flag = false; + float f3 = 0.5F; + float f4 = 1.0F; + float f5 = 0.8F; + float f6 = 0.6F; + float f7 = f4 * colorRed; + float f8 = f4 * colorGreen; + float f9 = f4 * colorBlue; + float f10 = f3; + float f11 = f5; + float f12 = f6; + float f13 = f3; + float f14 = f5; + float f15 = f6; + float f16 = f3; + float f17 = f5; + float f18 = f6; + + if (block != Block.grass) + { + f10 = f3 * colorRed; + f11 = f5 * colorRed; + f12 = f6 * colorRed; + f13 = f3 * colorGreen; + f14 = f5 * colorGreen; + f15 = f6 * colorGreen; + f16 = f3 * colorBlue; + f17 = f5 * colorBlue; + f18 = f6 * colorBlue; + } + + int l = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos); + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos, yPos - 1, zPos, 0)) + { + tessellator.setBrightness(render.renderMinY > 0.0D ? l : block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos)); + tessellator.setColorOpaque_F(f10, f13, f16); + render.renderFaceYNeg(block, (double)xPos, (double)yPos, (double)zPos, block.getIcon(0, metadata)); + flag = true; + } + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos, yPos + 1, zPos, 1)) + { + tessellator.setBrightness(render.renderMaxY < 1.0D ? l : block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos)); + tessellator.setColorOpaque_F(f7, f8, f9); + render.renderFaceYPos(block, (double)xPos, (double)yPos, (double)zPos, block.getIcon(1, metadata)); + flag = true; + } + + Icon icon; + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos, yPos, zPos - 1, 2)) + { + tessellator.setBrightness(render.renderMinZ > 0.0D ? l : block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos - 1)); + tessellator.setColorOpaque_F(f11, f14, f17); + render.renderFaceZNeg(block, (double)xPos, (double)yPos, (double)zPos, block.getIcon(2, metadata)); + + flag = true; + } + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos, yPos, zPos + 1, 3)) + { + tessellator.setBrightness(render.renderMaxZ < 1.0D ? l : block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos + 1)); + tessellator.setColorOpaque_F(f11, f14, f17); + render.renderFaceZPos(block, (double)xPos, (double)yPos, (double)zPos, block.getIcon(3, metadata)); + + flag = true; + } + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos - 1, yPos, zPos, 4)) + { + tessellator.setBrightness(render.renderMinX > 0.0D ? l : block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos)); + tessellator.setColorOpaque_F(f12, f15, f18); + render.renderFaceXNeg(block, (double)xPos, (double)yPos, (double)zPos, block.getIcon(4, metadata)); + + flag = true; + } + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos + 1, yPos, zPos, 5)) + { + tessellator.setBrightness(render.renderMaxX < 1.0D ? l : block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos)); + tessellator.setColorOpaque_F(f12, f15, f18); + render.renderFaceXPos(block, (double)xPos, (double)yPos, (double)zPos, block.getIcon(5, metadata)); + + flag = true; + } + + return flag; + } + + public static boolean renderFakeBlock (Icon texture, int x, int y, int z, RenderBlocks renderer, IBlockAccess world) + { + Block block = Block.stone; + int var5 = block.colorMultiplier(world, x, y, z); + float var6 = (float) (var5 >> 16 & 255) / 255.0F; + float var7 = (float) (var5 >> 8 & 255) / 255.0F; + float var8 = (float) (var5 & 255) / 255.0F; + + if (EntityRenderer.anaglyphEnable) + { + float var9 = (var6 * 30.0F + var7 * 59.0F + var8 * 11.0F) / 100.0F; + float var10 = (var6 * 30.0F + var7 * 70.0F) / 100.0F; + float var11 = (var6 * 30.0F + var8 * 70.0F) / 100.0F; + var6 = var9; + var7 = var10; + var8 = var11; + } + + return Minecraft.isAmbientOcclusionEnabled() ? + renderFakeBlockWithAmbientOcclusion(texture, x, y, z, var6, var7, var8, renderer, world) + : renderFakeBlockWithColorMultiplier(texture, x, y, z, var6, var7, var8, renderer, world); + } + + static boolean renderFakeBlockWithAmbientOcclusion(Icon texture, int xPos, int yPos, int zPos, + float colorRed, float colorGreen, float colorBlue, RenderBlocks render, IBlockAccess world) + { + Block block = Block.stone; + render.enableAO = true; + boolean flag = false; + float f3 = 0.0F; + float f4 = 0.0F; + float f5 = 0.0F; + float f6 = 0.0F; + boolean flag1 = true; + int l = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos); + Tessellator tessellator = Tessellator.instance; + tessellator.setBrightness(983055); + + if (render.getBlockIcon(block).getIconName().equals("grass_top")) + { + flag1 = false; + } + else if (render.hasOverrideBlockTexture()) + { + flag1 = false; + } + + boolean flag2; + boolean flag3; + boolean flag4; + boolean flag5; + float f7; + int i1; + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos, yPos - 1, zPos, 0)) + { + if (render.renderMinY <= 0.0D) + { + --yPos; + } + + render.aoBrightnessXYNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos); + render.aoBrightnessYZNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos - 1); + render.aoBrightnessYZNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos + 1); + render.aoBrightnessXYPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos); + render.aoLightValueScratchXYNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos, zPos); + render.aoLightValueScratchYZNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos, zPos - 1); + render.aoLightValueScratchYZNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos, zPos + 1); + render.aoLightValueScratchXYPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos, zPos); + flag3 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos + 1, yPos - 1, zPos)]; + flag2 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos - 1, yPos - 1, zPos)]; + flag5 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos, yPos - 1, zPos + 1)]; + flag4 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos, yPos - 1, zPos - 1)]; + + if (!flag4 && !flag2) + { + render.aoLightValueScratchXYZNNN = render.aoLightValueScratchXYNN; + render.aoBrightnessXYZNNN = render.aoBrightnessXYNN; + } + else + { + render.aoLightValueScratchXYZNNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos, zPos - 1); + render.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos - 1); + } + + if (!flag5 && !flag2) + { + render.aoLightValueScratchXYZNNP = render.aoLightValueScratchXYNN; + render.aoBrightnessXYZNNP = render.aoBrightnessXYNN; + } + else + { + render.aoLightValueScratchXYZNNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos, zPos + 1); + render.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos + 1); + } + + if (!flag4 && !flag3) + { + render.aoLightValueScratchXYZPNN = render.aoLightValueScratchXYPN; + render.aoBrightnessXYZPNN = render.aoBrightnessXYPN; + } + else + { + render.aoLightValueScratchXYZPNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos, zPos - 1); + render.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos - 1); + } + + if (!flag5 && !flag3) + { + render.aoLightValueScratchXYZPNP = render.aoLightValueScratchXYPN; + render.aoBrightnessXYZPNP = render.aoBrightnessXYPN; + } + else + { + render.aoLightValueScratchXYZPNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos, zPos + 1); + render.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos + 1); + } + + if (render.renderMinY <= 0.0D) + { + ++yPos; + } + + i1 = l; + + if (render.renderMinY <= 0.0D || !render.blockAccess.isBlockOpaqueCube(xPos, yPos - 1, zPos)) + { + i1 = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos); + } + + f7 = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos - 1, zPos); + f3 = (render.aoLightValueScratchXYZNNP + render.aoLightValueScratchXYNN + render.aoLightValueScratchYZNP + f7) / 4.0F; + f6 = (render.aoLightValueScratchYZNP + f7 + render.aoLightValueScratchXYZPNP + render.aoLightValueScratchXYPN) / 4.0F; + f5 = (f7 + render.aoLightValueScratchYZNN + render.aoLightValueScratchXYPN + render.aoLightValueScratchXYZPNN) / 4.0F; + f4 = (render.aoLightValueScratchXYNN + render.aoLightValueScratchXYZNNN + f7 + render.aoLightValueScratchYZNN) / 4.0F; + render.brightnessTopLeft = render.getAoBrightness(render.aoBrightnessXYZNNP, render.aoBrightnessXYNN, render.aoBrightnessYZNP, i1); + render.brightnessTopRight = render.getAoBrightness(render.aoBrightnessYZNP, render.aoBrightnessXYZPNP, render.aoBrightnessXYPN, i1); + render.brightnessBottomRight = render.getAoBrightness(render.aoBrightnessYZNN, render.aoBrightnessXYPN, render.aoBrightnessXYZPNN, i1); + render.brightnessBottomLeft = render.getAoBrightness(render.aoBrightnessXYNN, render.aoBrightnessXYZNNN, render.aoBrightnessYZNN, i1); + + if (flag1) + { + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = colorRed * 0.5F; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = colorGreen * 0.5F; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = colorBlue * 0.5F; + } + else + { + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = 0.5F; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = 0.5F; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = 0.5F; + } + + render.colorRedTopLeft *= f3; + render.colorGreenTopLeft *= f3; + render.colorBlueTopLeft *= f3; + render.colorRedBottomLeft *= f4; + render.colorGreenBottomLeft *= f4; + render.colorBlueBottomLeft *= f4; + render.colorRedBottomRight *= f5; + render.colorGreenBottomRight *= f5; + render.colorBlueBottomRight *= f5; + render.colorRedTopRight *= f6; + render.colorGreenTopRight *= f6; + render.colorBlueTopRight *= f6; + render.renderFaceYNeg(block, (double)xPos, (double)yPos, (double)zPos, texture); + flag = true; + } + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos, yPos + 1, zPos, 1)) + { + if (render.renderMaxY >= 1.0D) + { + ++yPos; + } + + render.aoBrightnessXYNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos); + render.aoBrightnessXYPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos); + render.aoBrightnessYZPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos - 1); + render.aoBrightnessYZPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos + 1); + render.aoLightValueScratchXYNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos, zPos); + render.aoLightValueScratchXYPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos, zPos); + render.aoLightValueScratchYZPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos, zPos - 1); + render.aoLightValueScratchYZPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos, zPos + 1); + flag3 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos + 1, yPos + 1, zPos)]; + flag2 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos - 1, yPos + 1, zPos)]; + flag5 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos, yPos + 1, zPos + 1)]; + flag4 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos, yPos + 1, zPos - 1)]; + + if (!flag4 && !flag2) + { + render.aoLightValueScratchXYZNPN = render.aoLightValueScratchXYNP; + render.aoBrightnessXYZNPN = render.aoBrightnessXYNP; + } + else + { + render.aoLightValueScratchXYZNPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos, zPos - 1); + render.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos - 1); + } + + if (!flag4 && !flag3) + { + render.aoLightValueScratchXYZPPN = render.aoLightValueScratchXYPP; + render.aoBrightnessXYZPPN = render.aoBrightnessXYPP; + } + else + { + render.aoLightValueScratchXYZPPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos, zPos - 1); + render.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos - 1); + } + + if (!flag5 && !flag2) + { + render.aoLightValueScratchXYZNPP = render.aoLightValueScratchXYNP; + render.aoBrightnessXYZNPP = render.aoBrightnessXYNP; + } + else + { + render.aoLightValueScratchXYZNPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos, zPos + 1); + render.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos + 1); + } + + if (!flag5 && !flag3) + { + render.aoLightValueScratchXYZPPP = render.aoLightValueScratchXYPP; + render.aoBrightnessXYZPPP = render.aoBrightnessXYPP; + } + else + { + render.aoLightValueScratchXYZPPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos, zPos + 1); + render.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos + 1); + } + + if (render.renderMaxY >= 1.0D) + { + --yPos; + } + + i1 = l; + + if (render.renderMaxY >= 1.0D || !render.blockAccess.isBlockOpaqueCube(xPos, yPos + 1, zPos)) + { + i1 = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos); + } + + f7 = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos + 1, zPos); + f6 = (render.aoLightValueScratchXYZNPP + render.aoLightValueScratchXYNP + render.aoLightValueScratchYZPP + f7) / 4.0F; + f3 = (render.aoLightValueScratchYZPP + f7 + render.aoLightValueScratchXYZPPP + render.aoLightValueScratchXYPP) / 4.0F; + f4 = (f7 + render.aoLightValueScratchYZPN + render.aoLightValueScratchXYPP + render.aoLightValueScratchXYZPPN) / 4.0F; + f5 = (render.aoLightValueScratchXYNP + render.aoLightValueScratchXYZNPN + f7 + render.aoLightValueScratchYZPN) / 4.0F; + render.brightnessTopRight = render.getAoBrightness(render.aoBrightnessXYZNPP, render.aoBrightnessXYNP, render.aoBrightnessYZPP, i1); + render.brightnessTopLeft = render.getAoBrightness(render.aoBrightnessYZPP, render.aoBrightnessXYZPPP, render.aoBrightnessXYPP, i1); + render.brightnessBottomLeft = render.getAoBrightness(render.aoBrightnessYZPN, render.aoBrightnessXYPP, render.aoBrightnessXYZPPN, i1); + render.brightnessBottomRight = render.getAoBrightness(render.aoBrightnessXYNP, render.aoBrightnessXYZNPN, render.aoBrightnessYZPN, i1); + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = colorRed; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = colorGreen; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = colorBlue; + render.colorRedTopLeft *= f3; + render.colorGreenTopLeft *= f3; + render.colorBlueTopLeft *= f3; + render.colorRedBottomLeft *= f4; + render.colorGreenBottomLeft *= f4; + render.colorBlueBottomLeft *= f4; + render.colorRedBottomRight *= f5; + render.colorGreenBottomRight *= f5; + render.colorBlueBottomRight *= f5; + render.colorRedTopRight *= f6; + render.colorGreenTopRight *= f6; + render.colorBlueTopRight *= f6; + render.renderFaceYPos(block, (double)xPos, (double)yPos, (double)zPos, texture); + flag = true; + } + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos, yPos, zPos - 1, 2)) + { + if (render.renderMinZ <= 0.0D) + { + --zPos; + } + + render.aoLightValueScratchXZNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos, zPos); + render.aoLightValueScratchYZNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos - 1, zPos); + render.aoLightValueScratchYZPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos + 1, zPos); + render.aoLightValueScratchXZPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos, zPos); + render.aoBrightnessXZNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos); + render.aoBrightnessYZNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos); + render.aoBrightnessYZPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos); + render.aoBrightnessXZPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos); + flag3 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos + 1, yPos, zPos - 1)]; + flag2 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos - 1, yPos, zPos - 1)]; + flag5 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos, yPos + 1, zPos - 1)]; + flag4 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos, yPos - 1, zPos - 1)]; + + if (!flag2 && !flag4) + { + render.aoLightValueScratchXYZNNN = render.aoLightValueScratchXZNN; + render.aoBrightnessXYZNNN = render.aoBrightnessXZNN; + } + else + { + render.aoLightValueScratchXYZNNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos - 1, zPos); + render.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos - 1, zPos); + } + + if (!flag2 && !flag5) + { + render.aoLightValueScratchXYZNPN = render.aoLightValueScratchXZNN; + render.aoBrightnessXYZNPN = render.aoBrightnessXZNN; + } + else + { + render.aoLightValueScratchXYZNPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos + 1, zPos); + render.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos + 1, zPos); + } + + if (!flag3 && !flag4) + { + render.aoLightValueScratchXYZPNN = render.aoLightValueScratchXZPN; + render.aoBrightnessXYZPNN = render.aoBrightnessXZPN; + } + else + { + render.aoLightValueScratchXYZPNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos - 1, zPos); + render.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos - 1, zPos); + } + + if (!flag3 && !flag5) + { + render.aoLightValueScratchXYZPPN = render.aoLightValueScratchXZPN; + render.aoBrightnessXYZPPN = render.aoBrightnessXZPN; + } + else + { + render.aoLightValueScratchXYZPPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos + 1, zPos); + render.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos + 1, zPos); + } + + if (render.renderMinZ <= 0.0D) + { + ++zPos; + } + + i1 = l; + + if (render.renderMinZ <= 0.0D || !render.blockAccess.isBlockOpaqueCube(xPos, yPos, zPos - 1)) + { + i1 = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos - 1); + } + + f7 = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos, zPos - 1); + f3 = (render.aoLightValueScratchXZNN + render.aoLightValueScratchXYZNPN + f7 + render.aoLightValueScratchYZPN) / 4.0F; + f4 = (f7 + render.aoLightValueScratchYZPN + render.aoLightValueScratchXZPN + render.aoLightValueScratchXYZPPN) / 4.0F; + f5 = (render.aoLightValueScratchYZNN + f7 + render.aoLightValueScratchXYZPNN + render.aoLightValueScratchXZPN) / 4.0F; + f6 = (render.aoLightValueScratchXYZNNN + render.aoLightValueScratchXZNN + render.aoLightValueScratchYZNN + f7) / 4.0F; + render.brightnessTopLeft = render.getAoBrightness(render.aoBrightnessXZNN, render.aoBrightnessXYZNPN, render.aoBrightnessYZPN, i1); + render.brightnessBottomLeft = render.getAoBrightness(render.aoBrightnessYZPN, render.aoBrightnessXZPN, render.aoBrightnessXYZPPN, i1); + render.brightnessBottomRight = render.getAoBrightness(render.aoBrightnessYZNN, render.aoBrightnessXYZPNN, render.aoBrightnessXZPN, i1); + render.brightnessTopRight = render.getAoBrightness(render.aoBrightnessXYZNNN, render.aoBrightnessXZNN, render.aoBrightnessYZNN, i1); + + if (flag1) + { + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = colorRed * 0.8F; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = colorGreen * 0.8F; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = colorBlue * 0.8F; + } + else + { + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = 0.8F; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = 0.8F; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = 0.8F; + } + + render.colorRedTopLeft *= f3; + render.colorGreenTopLeft *= f3; + render.colorBlueTopLeft *= f3; + render.colorRedBottomLeft *= f4; + render.colorGreenBottomLeft *= f4; + render.colorBlueBottomLeft *= f4; + render.colorRedBottomRight *= f5; + render.colorGreenBottomRight *= f5; + render.colorBlueBottomRight *= f5; + render.colorRedTopRight *= f6; + render.colorGreenTopRight *= f6; + render.colorBlueTopRight *= f6; + render.renderFaceZNeg(block, (double)xPos, (double)yPos, (double)zPos, texture); + + flag = true; + } + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos, yPos, zPos + 1, 3)) + { + if (render.renderMaxZ >= 1.0D) + { + ++zPos; + } + + render.aoLightValueScratchXZNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos, zPos); + render.aoLightValueScratchXZPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos, zPos); + render.aoLightValueScratchYZNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos - 1, zPos); + render.aoLightValueScratchYZPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos + 1, zPos); + render.aoBrightnessXZNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos); + render.aoBrightnessXZPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos); + render.aoBrightnessYZNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos); + render.aoBrightnessYZPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos); + flag3 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos + 1, yPos, zPos + 1)]; + flag2 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos - 1, yPos, zPos + 1)]; + flag5 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos, yPos + 1, zPos + 1)]; + flag4 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos, yPos - 1, zPos + 1)]; + + if (!flag2 && !flag4) + { + render.aoLightValueScratchXYZNNP = render.aoLightValueScratchXZNP; + render.aoBrightnessXYZNNP = render.aoBrightnessXZNP; + } + else + { + render.aoLightValueScratchXYZNNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos - 1, zPos); + render.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos - 1, zPos); + } + + if (!flag2 && !flag5) + { + render.aoLightValueScratchXYZNPP = render.aoLightValueScratchXZNP; + render.aoBrightnessXYZNPP = render.aoBrightnessXZNP; + } + else + { + render.aoLightValueScratchXYZNPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos + 1, zPos); + render.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos + 1, zPos); + } + + if (!flag3 && !flag4) + { + render.aoLightValueScratchXYZPNP = render.aoLightValueScratchXZPP; + render.aoBrightnessXYZPNP = render.aoBrightnessXZPP; + } + else + { + render.aoLightValueScratchXYZPNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos - 1, zPos); + render.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos - 1, zPos); + } + + if (!flag3 && !flag5) + { + render.aoLightValueScratchXYZPPP = render.aoLightValueScratchXZPP; + render.aoBrightnessXYZPPP = render.aoBrightnessXZPP; + } + else + { + render.aoLightValueScratchXYZPPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos + 1, zPos); + render.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos + 1, zPos); + } + + if (render.renderMaxZ >= 1.0D) + { + --zPos; + } + + i1 = l; + + if (render.renderMaxZ >= 1.0D || !render.blockAccess.isBlockOpaqueCube(xPos, yPos, zPos + 1)) + { + i1 = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos + 1); + } + + f7 = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos, zPos + 1); + f3 = (render.aoLightValueScratchXZNP + render.aoLightValueScratchXYZNPP + f7 + render.aoLightValueScratchYZPP) / 4.0F; + f6 = (f7 + render.aoLightValueScratchYZPP + render.aoLightValueScratchXZPP + render.aoLightValueScratchXYZPPP) / 4.0F; + f5 = (render.aoLightValueScratchYZNP + f7 + render.aoLightValueScratchXYZPNP + render.aoLightValueScratchXZPP) / 4.0F; + f4 = (render.aoLightValueScratchXYZNNP + render.aoLightValueScratchXZNP + render.aoLightValueScratchYZNP + f7) / 4.0F; + render.brightnessTopLeft = render.getAoBrightness(render.aoBrightnessXZNP, render.aoBrightnessXYZNPP, render.aoBrightnessYZPP, i1); + render.brightnessTopRight = render.getAoBrightness(render.aoBrightnessYZPP, render.aoBrightnessXZPP, render.aoBrightnessXYZPPP, i1); + render.brightnessBottomRight = render.getAoBrightness(render.aoBrightnessYZNP, render.aoBrightnessXYZPNP, render.aoBrightnessXZPP, i1); + render.brightnessBottomLeft = render.getAoBrightness(render.aoBrightnessXYZNNP, render.aoBrightnessXZNP, render.aoBrightnessYZNP, i1); + + if (flag1) + { + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = colorRed * 0.8F; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = colorGreen * 0.8F; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = colorBlue * 0.8F; + } + else + { + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = 0.8F; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = 0.8F; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = 0.8F; + } + + render.colorRedTopLeft *= f3; + render.colorGreenTopLeft *= f3; + render.colorBlueTopLeft *= f3; + render.colorRedBottomLeft *= f4; + render.colorGreenBottomLeft *= f4; + render.colorBlueBottomLeft *= f4; + render.colorRedBottomRight *= f5; + render.colorGreenBottomRight *= f5; + render.colorBlueBottomRight *= f5; + render.colorRedTopRight *= f6; + render.colorGreenTopRight *= f6; + render.colorBlueTopRight *= f6; + render.renderFaceZPos(block, (double)xPos, (double)yPos, (double)zPos, texture); + + flag = true; + } + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos - 1, yPos, zPos, 4)) + { + if (render.renderMinX <= 0.0D) + { + --xPos; + } + + render.aoLightValueScratchXYNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos - 1, zPos); + render.aoLightValueScratchXZNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos, zPos - 1); + render.aoLightValueScratchXZNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos, zPos + 1); + render.aoLightValueScratchXYNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos + 1, zPos); + render.aoBrightnessXYNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos); + render.aoBrightnessXZNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos - 1); + render.aoBrightnessXZNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos + 1); + render.aoBrightnessXYNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos); + flag3 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos - 1, yPos + 1, zPos)]; + flag2 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos - 1, yPos - 1, zPos)]; + flag5 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos - 1, yPos, zPos - 1)]; + flag4 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos - 1, yPos, zPos + 1)]; + + if (!flag5 && !flag2) + { + render.aoLightValueScratchXYZNNN = render.aoLightValueScratchXZNN; + render.aoBrightnessXYZNNN = render.aoBrightnessXZNN; + } + else + { + render.aoLightValueScratchXYZNNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos - 1, zPos - 1); + render.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos - 1); + } + + if (!flag4 && !flag2) + { + render.aoLightValueScratchXYZNNP = render.aoLightValueScratchXZNP; + render.aoBrightnessXYZNNP = render.aoBrightnessXZNP; + } + else + { + render.aoLightValueScratchXYZNNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos - 1, zPos + 1); + render.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos + 1); + } + + if (!flag5 && !flag3) + { + render.aoLightValueScratchXYZNPN = render.aoLightValueScratchXZNN; + render.aoBrightnessXYZNPN = render.aoBrightnessXZNN; + } + else + { + render.aoLightValueScratchXYZNPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos + 1, zPos - 1); + render.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos - 1); + } + + if (!flag4 && !flag3) + { + render.aoLightValueScratchXYZNPP = render.aoLightValueScratchXZNP; + render.aoBrightnessXYZNPP = render.aoBrightnessXZNP; + } + else + { + render.aoLightValueScratchXYZNPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos + 1, zPos + 1); + render.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos + 1); + } + + if (render.renderMinX <= 0.0D) + { + ++xPos; + } + + i1 = l; + + if (render.renderMinX <= 0.0D || !render.blockAccess.isBlockOpaqueCube(xPos - 1, yPos, zPos)) + { + i1 = block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos); + } + + f7 = block.getAmbientOcclusionLightValue(render.blockAccess, xPos - 1, yPos, zPos); + f6 = (render.aoLightValueScratchXYNN + render.aoLightValueScratchXYZNNP + f7 + render.aoLightValueScratchXZNP) / 4.0F; + f3 = (f7 + render.aoLightValueScratchXZNP + render.aoLightValueScratchXYNP + render.aoLightValueScratchXYZNPP) / 4.0F; + f4 = (render.aoLightValueScratchXZNN + f7 + render.aoLightValueScratchXYZNPN + render.aoLightValueScratchXYNP) / 4.0F; + f5 = (render.aoLightValueScratchXYZNNN + render.aoLightValueScratchXYNN + render.aoLightValueScratchXZNN + f7) / 4.0F; + render.brightnessTopRight = render.getAoBrightness(render.aoBrightnessXYNN, render.aoBrightnessXYZNNP, render.aoBrightnessXZNP, i1); + render.brightnessTopLeft = render.getAoBrightness(render.aoBrightnessXZNP, render.aoBrightnessXYNP, render.aoBrightnessXYZNPP, i1); + render.brightnessBottomLeft = render.getAoBrightness(render.aoBrightnessXZNN, render.aoBrightnessXYZNPN, render.aoBrightnessXYNP, i1); + render.brightnessBottomRight = render.getAoBrightness(render.aoBrightnessXYZNNN, render.aoBrightnessXYNN, render.aoBrightnessXZNN, i1); + + if (flag1) + { + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = colorRed * 0.6F; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = colorGreen * 0.6F; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = colorBlue * 0.6F; + } + else + { + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = 0.6F; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = 0.6F; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = 0.6F; + } + + render.colorRedTopLeft *= f3; + render.colorGreenTopLeft *= f3; + render.colorBlueTopLeft *= f3; + render.colorRedBottomLeft *= f4; + render.colorGreenBottomLeft *= f4; + render.colorBlueBottomLeft *= f4; + render.colorRedBottomRight *= f5; + render.colorGreenBottomRight *= f5; + render.colorBlueBottomRight *= f5; + render.colorRedTopRight *= f6; + render.colorGreenTopRight *= f6; + render.colorBlueTopRight *= f6; + render.renderFaceXNeg(block, (double)xPos, (double)yPos, (double)zPos, texture); + + flag = true; + } + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos + 1, yPos, zPos, 5)) + { + if (render.renderMaxX >= 1.0D) + { + ++xPos; + } + + render.aoLightValueScratchXYPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos - 1, zPos); + render.aoLightValueScratchXZPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos, zPos - 1); + render.aoLightValueScratchXZPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos, zPos + 1); + render.aoLightValueScratchXYPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos + 1, zPos); + render.aoBrightnessXYPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos); + render.aoBrightnessXZPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos - 1); + render.aoBrightnessXZPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos + 1); + render.aoBrightnessXYPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos); + flag3 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos + 1, yPos + 1, zPos)]; + flag2 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos + 1, yPos - 1, zPos)]; + flag5 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos + 1, yPos, zPos + 1)]; + flag4 = Block.canBlockGrass[render.blockAccess.getBlockId(xPos + 1, yPos, zPos - 1)]; + + if (!flag2 && !flag4) + { + render.aoLightValueScratchXYZPNN = render.aoLightValueScratchXZPN; + render.aoBrightnessXYZPNN = render.aoBrightnessXZPN; + } + else + { + render.aoLightValueScratchXYZPNN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos - 1, zPos - 1); + render.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos - 1); + } + + if (!flag2 && !flag5) + { + render.aoLightValueScratchXYZPNP = render.aoLightValueScratchXZPP; + render.aoBrightnessXYZPNP = render.aoBrightnessXZPP; + } + else + { + render.aoLightValueScratchXYZPNP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos - 1, zPos + 1); + render.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos + 1); + } + + if (!flag3 && !flag4) + { + render.aoLightValueScratchXYZPPN = render.aoLightValueScratchXZPN; + render.aoBrightnessXYZPPN = render.aoBrightnessXZPN; + } + else + { + render.aoLightValueScratchXYZPPN = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos + 1, zPos - 1); + render.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos - 1); + } + + if (!flag3 && !flag5) + { + render.aoLightValueScratchXYZPPP = render.aoLightValueScratchXZPP; + render.aoBrightnessXYZPPP = render.aoBrightnessXZPP; + } + else + { + render.aoLightValueScratchXYZPPP = block.getAmbientOcclusionLightValue(render.blockAccess, xPos, yPos + 1, zPos + 1); + render.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos + 1); + } + + if (render.renderMaxX >= 1.0D) + { + --xPos; + } + + i1 = l; + + if (render.renderMaxX >= 1.0D || !render.blockAccess.isBlockOpaqueCube(xPos + 1, yPos, zPos)) + { + i1 = block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos); + } + + f7 = block.getAmbientOcclusionLightValue(render.blockAccess, xPos + 1, yPos, zPos); + f3 = (render.aoLightValueScratchXYPN + render.aoLightValueScratchXYZPNP + f7 + render.aoLightValueScratchXZPP) / 4.0F; + f4 = (render.aoLightValueScratchXYZPNN + render.aoLightValueScratchXYPN + render.aoLightValueScratchXZPN + f7) / 4.0F; + f5 = (render.aoLightValueScratchXZPN + f7 + render.aoLightValueScratchXYZPPN + render.aoLightValueScratchXYPP) / 4.0F; + f6 = (f7 + render.aoLightValueScratchXZPP + render.aoLightValueScratchXYPP + render.aoLightValueScratchXYZPPP) / 4.0F; + render.brightnessTopLeft = render.getAoBrightness(render.aoBrightnessXYPN, render.aoBrightnessXYZPNP, render.aoBrightnessXZPP, i1); + render.brightnessTopRight = render.getAoBrightness(render.aoBrightnessXZPP, render.aoBrightnessXYPP, render.aoBrightnessXYZPPP, i1); + render.brightnessBottomRight = render.getAoBrightness(render.aoBrightnessXZPN, render.aoBrightnessXYZPPN, render.aoBrightnessXYPP, i1); + render.brightnessBottomLeft = render.getAoBrightness(render.aoBrightnessXYZPNN, render.aoBrightnessXYPN, render.aoBrightnessXZPN, i1); + + if (flag1) + { + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = colorRed * 0.6F; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = colorGreen * 0.6F; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = colorBlue * 0.6F; + } + else + { + render.colorRedTopLeft = render.colorRedBottomLeft = render.colorRedBottomRight = render.colorRedTopRight = 0.6F; + render.colorGreenTopLeft = render.colorGreenBottomLeft = render.colorGreenBottomRight = render.colorGreenTopRight = 0.6F; + render.colorBlueTopLeft = render.colorBlueBottomLeft = render.colorBlueBottomRight = render.colorBlueTopRight = 0.6F; + } + + render.colorRedTopLeft *= f3; + render.colorGreenTopLeft *= f3; + render.colorBlueTopLeft *= f3; + render.colorRedBottomLeft *= f4; + render.colorGreenBottomLeft *= f4; + render.colorBlueBottomLeft *= f4; + render.colorRedBottomRight *= f5; + render.colorGreenBottomRight *= f5; + render.colorBlueBottomRight *= f5; + render.colorRedTopRight *= f6; + render.colorGreenTopRight *= f6; + render.colorBlueTopRight *= f6; + render.renderFaceXPos(block, (double)xPos, (double)yPos, (double)zPos, texture); + + flag = true; + } + + render.enableAO = false; + return flag; + } + + static boolean renderFakeBlockWithColorMultiplier(Icon texture, int xPos, int yPos, int zPos, float colorRed, float colorGreen, float colorBlue, RenderBlocks render, IBlockAccess world) + { + Block block = Block.stone; + render.enableAO = false; + Tessellator tessellator = Tessellator.instance; + boolean flag = false; + float f3 = 0.5F; + float f4 = 1.0F; + float f5 = 0.8F; + float f6 = 0.6F; + float f7 = f4 * colorRed; + float f8 = f4 * colorGreen; + float f9 = f4 * colorBlue; + float f10 = f3; + float f11 = f5; + float f12 = f6; + float f13 = f3; + float f14 = f5; + float f15 = f6; + float f16 = f3; + float f17 = f5; + float f18 = f6; + + if (block != Block.grass) + { + f10 = f3 * colorRed; + f11 = f5 * colorRed; + f12 = f6 * colorRed; + f13 = f3 * colorGreen; + f14 = f5 * colorGreen; + f15 = f6 * colorGreen; + f16 = f3 * colorBlue; + f17 = f5 * colorBlue; + f18 = f6 * colorBlue; + } + + int l = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos); + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos, yPos - 1, zPos, 0)) + { + tessellator.setBrightness(render.renderMinY > 0.0D ? l : block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos)); + tessellator.setColorOpaque_F(f10, f13, f16); + render.renderFaceYNeg(block, (double)xPos, (double)yPos, (double)zPos, texture); + flag = true; + } + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos, yPos + 1, zPos, 1)) + { + tessellator.setBrightness(render.renderMaxY < 1.0D ? l : block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos)); + tessellator.setColorOpaque_F(f7, f8, f9); + render.renderFaceYPos(block, (double)xPos, (double)yPos, (double)zPos, texture); + flag = true; + } + + Icon icon; + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos, yPos, zPos - 1, 2)) + { + tessellator.setBrightness(render.renderMinZ > 0.0D ? l : block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos - 1)); + tessellator.setColorOpaque_F(f11, f14, f17); + render.renderFaceZNeg(block, (double)xPos, (double)yPos, (double)zPos, texture); + + flag = true; + } + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos, yPos, zPos + 1, 3)) + { + tessellator.setBrightness(render.renderMaxZ < 1.0D ? l : block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos + 1)); + tessellator.setColorOpaque_F(f11, f14, f17); + render.renderFaceZPos(block, (double)xPos, (double)yPos, (double)zPos, texture); + + flag = true; + } + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos - 1, yPos, zPos, 4)) + { + tessellator.setBrightness(render.renderMinX > 0.0D ? l : block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos)); + tessellator.setColorOpaque_F(f12, f15, f18); + render.renderFaceXNeg(block, (double)xPos, (double)yPos, (double)zPos, texture); + + flag = true; + } + + if (render.renderAllFaces || block.shouldSideBeRendered(render.blockAccess, xPos + 1, yPos, zPos, 5)) + { + tessellator.setBrightness(render.renderMaxX < 1.0D ? l : block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos)); + tessellator.setColorOpaque_F(f12, f15, f18); + render.renderFaceXPos(block, (double)xPos, (double)yPos, (double)zPos, texture); + + flag = true; + } + + return flag; + } +} diff --git a/src/minecraft/biomesoplenty/blocks/renderers/PuddleRender.java b/src/minecraft/biomesoplenty/blocks/renderers/PuddleRender.java new file mode 100644 index 000000000..65cb71ba4 --- /dev/null +++ b/src/minecraft/biomesoplenty/blocks/renderers/PuddleRender.java @@ -0,0 +1,89 @@ +package biomesoplenty.blocks.renderers; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.item.Item; +import net.minecraft.world.IBlockAccess; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.liquids.LiquidStack; + +import org.lwjgl.opengl.GL11; + +import biomesoplenty.BiomesOPlenty; + +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; + +public class PuddleRender implements ISimpleBlockRenderingHandler +{ + public static int puddleID = RenderingRegistry.getNextAvailableRenderId(); + + @Override + public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer) + { + if (modelID == puddleID) + { + RenderUtils.renderStandardInvBlock(renderer, block, metadata); + } + } + + @Override + public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) + { + if (modelID == puddleID) + { + renderer.renderStandardBlock(block, x, y, z); + + //Liquid + renderer.setRenderBounds(0.0, 0.8135, 0.0, 1.0, 0.8880, 1.0); + + Block liquidBlock = Block.blocksList[Block.waterStill.blockID]; + BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, 0, x, y, z, renderer, world); + } + return true; + } + + @Override + public boolean shouldRender3DInInventory() + { + return true; + } + + @Override + public int getRenderId() + { + return puddleID; + } + + private void renderDoRe (RenderBlocks renderblocks, Block block, int meta) + { + Tessellator tessellator = Tessellator.instance; + GL11.glTranslatef(-0.5F, 0.5F, -0.5F); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, -1F, 0.0F); + renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 1.0F, 0.0F); + renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 0.0F, -1F); + renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 0.0F, 1.0F); + renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(-1F, 0.0F, 0.0F); + renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(1.0F, 0.0F, 0.0F); + renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta)); + tessellator.draw(); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } +} diff --git a/src/minecraft/biomesoplenty/configuration/BOPBlocks.java b/src/minecraft/biomesoplenty/configuration/BOPBlocks.java index 3664f22d7..94daa2f1e 100644 --- a/src/minecraft/biomesoplenty/configuration/BOPBlocks.java +++ b/src/minecraft/biomesoplenty/configuration/BOPBlocks.java @@ -3,7 +3,6 @@ package biomesoplenty.configuration; import net.minecraft.block.Block; import net.minecraft.block.BlockHalfSlab; import net.minecraft.block.material.Material; -import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import biomesoplenty.api.Blocks; import biomesoplenty.blocks.BlockAltar; @@ -42,6 +41,7 @@ import biomesoplenty.blocks.BlockMoss; import biomesoplenty.blocks.BlockMud; import biomesoplenty.blocks.BlockOriginGrass; import biomesoplenty.blocks.BlockPromisedPortal; +import biomesoplenty.blocks.BlockPuddle; import biomesoplenty.blocks.BlockTreeMoss; import biomesoplenty.blocks.BlockWillow; import biomesoplenty.items.ItemBOPAltar; @@ -75,7 +75,6 @@ import biomesoplenty.tileentity.TileEntityAltar; import com.google.common.base.Optional; import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; public class BOPBlocks { public static void init() @@ -172,6 +171,8 @@ public class BOPBlocks { Blocks.glass = Optional.of((new BlockBOPGlass(BOPConfiguration.glassID)).setStepSound(Block.soundGlassFootstep).setUnlocalizedName("bop.glass")); Blocks.altar = Optional.of((new BlockAltar(BOPConfiguration.altarID)).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("bop.altar")); + + Blocks.puddle = Optional.of((new BlockPuddle(BOPConfiguration.puddleID)).setStepSound(Block.soundGravelFootstep).setUnlocalizedName("bop.puddle")); Blocks.planks = Optional.of((new BlockBOPPlank(BOPConfiguration.planksID)).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("bop.planks")); @@ -252,6 +253,7 @@ public class BOPBlocks { GameRegistry.registerBlock(Blocks.bones.get(), ItemBOPBones.class, "bop.bones"); GameRegistry.registerBlock(Blocks.glass.get(), ItemBOPGlass.class, "bop.glass"); GameRegistry.registerBlock(Blocks.altar.get(), ItemBOPAltar.class, "bop.altar"); + GameRegistry.registerBlock(Blocks.puddle.get(), "bop.puddle"); ItemBOPSlab.setSlabs(Blocks.stoneSingleSlab.get(), Blocks.stoneDoubleSlab.get()); GameRegistry.registerBlock(Blocks.stoneDoubleSlab.get(), ItemBOPSlab.class, "bop.stoneDoubleSlab"); diff --git a/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java b/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java index fe202bd94..437b94e6c 100644 --- a/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java +++ b/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java @@ -181,6 +181,8 @@ public class BOPConfiguration { // public static int smolderingGrassID; // public static int quicksandID; + + public static int puddleID; public static int planksID; @@ -798,6 +800,8 @@ public class BOPConfiguration { glassID = config.getBlock("Glass ID", 1978, null).getInt(); altarID = config.getBlock("Altar ID", 1979, null).getInt(); + + puddleID = config.getBlock("Puddle ID", 1980, null).getInt(); // Get Item ID's shroomPowderID = config.getItem("Shroom Powder ID", 21001, null).getInt();