Search in sources :

Example 41 with IIcon

use of net.minecraft.util.IIcon in project Engine by VoltzEngine-Project.

the class FluidRenderUtility method renderFluidTesselation.

/*public static int[] getFluidDisplayLists(FluidStack fluidStack, World world, boolean flowing)
	{
		if (fluidStack == null)
		{
			return null;
		}
		Fluid fluid = fluidStack.getFluid();
		if (fluid == null)
		{
			return null;
		}
		Map<Fluid, int[]> cache = flowing ? flowingRenderCache : stillRenderCache;
		int[] diplayLists = cache.get(fluid);
		if (diplayLists != null)
		{
			return diplayLists;
		}

		diplayLists = new int[DISPLAY_STAGES];

		if (fluid.getBlockID() > 0)
		{
			liquidBlock.baseBlock = Block.blocksList[fluid.getBlockID()];
			liquidBlock.texture = getFluidTexture(fluidStack.getFluid(), flowing);
		}
		else
		{
			liquidBlock.baseBlock = Block.waterStill;
			liquidBlock.texture = getFluidTexture(fluidStack.getFluid(), flowing);
		}

		cache.put(fluid, diplayLists);

		GL11.glDisable(GL11.GL_LIGHTING);
		GL11.glDisable(GL11.GL_BLEND);
		GL11.glDisable(GL11.GL_CULL_FACE);

		for (int s = 0; s < DISPLAY_STAGES; ++s)
		{
			diplayLists[s] = GLAllocation.generateDisplayLists(1);
			GL11.glNewList(diplayLists[s], 4864 /* GL_COMPILE *);

			liquidBlock.min.x = 0.01f;
			liquidBlock.min.y = 0;
			liquidBlock.min.z = 0.01f;

			liquidBlock.max.x = 0.99f;
			liquidBlock.max.y = (float) s / (float) DISPLAY_STAGES;
			liquidBlock.max.z = 0.99f;

			RenderBlockEntity.instance.renderBlock(liquidBlock, world, 0, 0, 0, false, true);

			GL11.glEndList();
		}

		GL11.glColor4f(1, 1, 1, 1);
		GL11.glEnable(GL11.GL_CULL_FACE);
		GL11.glEnable(GL11.GL_BLEND);
		GL11.glEnable(GL11.GL_LIGHTING);

		return diplayLists;
	}*/
/**
 * Based on Open Blocks tank renderer
 *
 * @param tank
 */
public static void renderFluidTesselation(IFluidTank tank, double ySouthEast, double yNorthEast, double ySouthWest, double yNorthWest) {
    FluidStack fluidStack = tank.getFluid();
    if (fluidStack != null && fluidStack.amount > 0) {
        GL11.glPushMatrix();
        GL11.glDisable(2896);
        Fluid fluid = fluidStack.getFluid();
        IIcon texture = fluid.getStillIcon();
        RenderUtility.bind(getFluidSheet(fluid));
        int color = fluid.getColor(fluidStack);
        Tessellator t = Tessellator.instance;
        double uMin = texture.getInterpolatedU(0.0);
        double uMax = texture.getInterpolatedU(16.0);
        double vMin = texture.getInterpolatedV(0.0);
        double vMax = texture.getInterpolatedV(16.0);
        double vHeight = vMax - vMin;
        float r = (color >> 16 & 0xFF) / 255.0F;
        float g = (color >> 8 & 0xFF) / 255.0F;
        float b = (color & 0xFF) / 255.0F;
        // north side
        t.startDrawingQuads();
        t.setColorOpaque_F(r, g, b);
        // bottom
        t.addVertexWithUV(0.5, -0.5, -0.5, uMax, vMin);
        // bottom
        t.addVertexWithUV(-0.5, -0.5, -0.5, uMin, vMin);
        // top
        t.addVertexWithUV(-0.5, -0.5 + yNorthWest, -0.5, uMin, vMin + (vHeight * yNorthWest));
        // north/west
        t.addVertexWithUV(0.5, -0.5 + yNorthEast, -0.5, uMax, vMin + (vHeight * yNorthEast));
        // top
        // north/east
        t.draw();
        // south side
        t.startDrawingQuads();
        t.setColorOpaque_F(r, g, b);
        // top
        t.addVertexWithUV(0.5, -0.5, 0.5, uMin, vMin);
        // south
        t.addVertexWithUV(0.5, -0.5 + ySouthEast, 0.5, uMin, vMin + (vHeight * ySouthEast));
        // east
        t.addVertexWithUV(-0.5, -0.5 + ySouthWest, 0.5, uMax, vMin + (vHeight * ySouthWest));
        // top
        // south
        // west
        t.addVertexWithUV(-0.5, -0.5, 0.5, uMax, vMin);
        t.draw();
        // east side
        t.startDrawingQuads();
        t.setColorOpaque_F(r, g, b);
        // top
        t.addVertexWithUV(0.5, -0.5, -0.5, uMin, vMin);
        // north/east
        t.addVertexWithUV(0.5, -0.5 + yNorthEast, -0.5, uMin, vMin + (vHeight * yNorthEast));
        // top
        // south/east
        t.addVertexWithUV(0.5, -0.5 + ySouthEast, 0.5, uMax, vMin + (vHeight * ySouthEast));
        t.addVertexWithUV(0.5, -0.5, 0.5, uMax, vMin);
        t.draw();
        // west side
        t.startDrawingQuads();
        t.setColorOpaque_F(r, g, b);
        t.addVertexWithUV(-0.5, -0.5, 0.5, uMin, vMin);
        // top
        // south/west
        t.addVertexWithUV(-0.5, -0.5 + ySouthWest, 0.5, uMin, vMin + (vHeight * ySouthWest));
        // top
        // north/west
        t.addVertexWithUV(-0.5, -0.5 + yNorthWest, -0.5, uMax, vMin + (vHeight * yNorthWest));
        t.addVertexWithUV(-0.5, -0.5, -0.5, uMax, vMin);
        t.draw();
        // top
        t.startDrawingQuads();
        t.setColorOpaque_F(r, g, b);
        // south
        // east
        t.addVertexWithUV(0.5, -0.5 + ySouthEast, 0.5, uMax, vMin);
        // north
        // east
        t.addVertexWithUV(0.5, -0.5 + yNorthEast, -0.5, uMin, vMin);
        // north
        // west
        t.addVertexWithUV(-0.5, -0.5 + yNorthWest, -0.5, uMin, vMax);
        // south
        // west
        t.addVertexWithUV(-0.5, -0.5 + ySouthWest, 0.5, uMax, vMax);
        t.draw();
        // bottom
        t.startDrawingQuads();
        t.setColorOpaque_F(r, g, b);
        t.addVertexWithUV(0.5, -0.5, -0.5, uMax, vMin);
        t.addVertexWithUV(0.5, -0.5, 0.5, uMin, vMin);
        t.addVertexWithUV(-0.5, -0.5, 0.5, uMin, vMax);
        t.addVertexWithUV(-0.5, -0.5, -0.5, uMax, vMax);
        t.draw();
        GL11.glEnable(2896);
        GL11.glPopMatrix();
    }
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) IIcon(net.minecraft.util.IIcon) FluidStack(net.minecraftforge.fluids.FluidStack) Fluid(net.minecraftforge.fluids.Fluid)

Example 42 with IIcon

use of net.minecraft.util.IIcon in project Engine by VoltzEngine-Project.

the class RenderBlockAdvanced method renderStandardBlockWithAmbientOcclusionPartial.

/**
 * Renders non-full-cube block with ambient occusion. Args: block, x, y, z, red, green, blue
 * (lighting)
 */
@Override
public boolean renderStandardBlockWithAmbientOcclusionPartial(Block p_147808_1_, int p_147808_2_, int p_147808_3_, int p_147808_4_, float p_147808_5_, float p_147808_6_, float p_147808_7_) {
    this.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 = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_, p_147808_4_);
    Tessellator tessellator = Tessellator.instance;
    tessellator.setBrightness(983055);
    if (this.getBlockIcon(p_147808_1_).getIconName().equals("grass_top")) {
        flag1 = false;
    } else if (this.hasOverrideBlockTexture()) {
        flag1 = false;
    }
    boolean flag2;
    boolean flag3;
    boolean flag4;
    boolean flag5;
    int i1;
    float f7;
    if (this.renderAllFaces || p_147808_1_.shouldSideBeRendered(this.blockAccess, p_147808_2_, p_147808_3_ - 1, p_147808_4_, 0) && limitedSide == 0) {
        if (this.renderMinY <= 0.0D) {
            --p_147808_3_;
        }
        this.aoBrightnessXYNN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ - 1, p_147808_3_, p_147808_4_);
        this.aoBrightnessYZNN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_, p_147808_4_ - 1);
        this.aoBrightnessYZNP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_, p_147808_4_ + 1);
        this.aoBrightnessXYPN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ + 1, p_147808_3_, p_147808_4_);
        this.aoLightValueScratchXYNN = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_, p_147808_4_).getAmbientOcclusionLightValue();
        this.aoLightValueScratchYZNN = this.blockAccess.getBlock(p_147808_2_, p_147808_3_, p_147808_4_ - 1).getAmbientOcclusionLightValue();
        this.aoLightValueScratchYZNP = this.blockAccess.getBlock(p_147808_2_, p_147808_3_, p_147808_4_ + 1).getAmbientOcclusionLightValue();
        this.aoLightValueScratchXYPN = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_, p_147808_4_).getAmbientOcclusionLightValue();
        flag2 = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_ - 1, p_147808_4_).getCanBlockGrass();
        flag3 = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_ - 1, p_147808_4_).getCanBlockGrass();
        flag4 = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ - 1, p_147808_4_ + 1).getCanBlockGrass();
        flag5 = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ - 1, p_147808_4_ - 1).getCanBlockGrass();
        if (!flag5 && !flag3) {
            this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXYNN;
            this.aoBrightnessXYZNNN = this.aoBrightnessXYNN;
        } else {
            this.aoLightValueScratchXYZNNN = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_, p_147808_4_ - 1).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZNNN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ - 1, p_147808_3_, p_147808_4_ - 1);
        }
        if (!flag4 && !flag3) {
            this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXYNN;
            this.aoBrightnessXYZNNP = this.aoBrightnessXYNN;
        } else {
            this.aoLightValueScratchXYZNNP = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_, p_147808_4_ + 1).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZNNP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ - 1, p_147808_3_, p_147808_4_ + 1);
        }
        if (!flag5 && !flag2) {
            this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXYPN;
            this.aoBrightnessXYZPNN = this.aoBrightnessXYPN;
        } else {
            this.aoLightValueScratchXYZPNN = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_, p_147808_4_ - 1).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZPNN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ + 1, p_147808_3_, p_147808_4_ - 1);
        }
        if (!flag4 && !flag2) {
            this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXYPN;
            this.aoBrightnessXYZPNP = this.aoBrightnessXYPN;
        } else {
            this.aoLightValueScratchXYZPNP = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_, p_147808_4_ + 1).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZPNP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ + 1, p_147808_3_, p_147808_4_ + 1);
        }
        if (this.renderMinY <= 0.0D) {
            ++p_147808_3_;
        }
        i1 = l;
        if (this.renderMinY <= 0.0D || !this.blockAccess.getBlock(p_147808_2_, p_147808_3_ - 1, p_147808_4_).isOpaqueCube()) {
            i1 = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_ - 1, p_147808_4_);
        }
        f7 = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ - 1, p_147808_4_).getAmbientOcclusionLightValue();
        f3 = (this.aoLightValueScratchXYZNNP + this.aoLightValueScratchXYNN + this.aoLightValueScratchYZNP + f7) / 4.0F;
        f6 = (this.aoLightValueScratchYZNP + f7 + this.aoLightValueScratchXYZPNP + this.aoLightValueScratchXYPN) / 4.0F;
        f5 = (f7 + this.aoLightValueScratchYZNN + this.aoLightValueScratchXYPN + this.aoLightValueScratchXYZPNN) / 4.0F;
        f4 = (this.aoLightValueScratchXYNN + this.aoLightValueScratchXYZNNN + f7 + this.aoLightValueScratchYZNN) / 4.0F;
        this.brightnessTopLeft = this.getAoBrightness(this.aoBrightnessXYZNNP, this.aoBrightnessXYNN, this.aoBrightnessYZNP, i1);
        this.brightnessTopRight = this.getAoBrightness(this.aoBrightnessYZNP, this.aoBrightnessXYZPNP, this.aoBrightnessXYPN, i1);
        this.brightnessBottomRight = this.getAoBrightness(this.aoBrightnessYZNN, this.aoBrightnessXYPN, this.aoBrightnessXYZPNN, i1);
        this.brightnessBottomLeft = this.getAoBrightness(this.aoBrightnessXYNN, this.aoBrightnessXYZNNN, this.aoBrightnessYZNN, i1);
        if (flag1) {
            this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = p_147808_5_ * 0.5F;
            this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = p_147808_6_ * 0.5F;
            this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = p_147808_7_ * 0.5F;
        } else {
            this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.5F;
            this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.5F;
            this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.5F;
        }
        this.colorRedTopLeft *= f3;
        this.colorGreenTopLeft *= f3;
        this.colorBlueTopLeft *= f3;
        this.colorRedBottomLeft *= f4;
        this.colorGreenBottomLeft *= f4;
        this.colorBlueBottomLeft *= f4;
        this.colorRedBottomRight *= f5;
        this.colorGreenBottomRight *= f5;
        this.colorBlueBottomRight *= f5;
        this.colorRedTopRight *= f6;
        this.colorGreenTopRight *= f6;
        this.colorBlueTopRight *= f6;
        this.renderFaceYNeg(p_147808_1_, (double) p_147808_2_, (double) p_147808_3_, (double) p_147808_4_, this.getBlockIcon(p_147808_1_, this.blockAccess, p_147808_2_, p_147808_3_, p_147808_4_, 0));
        flag = true;
    }
    if (this.renderAllFaces || p_147808_1_.shouldSideBeRendered(this.blockAccess, p_147808_2_, p_147808_3_ + 1, p_147808_4_, 1) && limitedSide == 1) {
        if (this.renderMaxY >= 1.0D) {
            ++p_147808_3_;
        }
        this.aoBrightnessXYNP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ - 1, p_147808_3_, p_147808_4_);
        this.aoBrightnessXYPP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ + 1, p_147808_3_, p_147808_4_);
        this.aoBrightnessYZPN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_, p_147808_4_ - 1);
        this.aoBrightnessYZPP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_, p_147808_4_ + 1);
        this.aoLightValueScratchXYNP = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_, p_147808_4_).getAmbientOcclusionLightValue();
        this.aoLightValueScratchXYPP = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_, p_147808_4_).getAmbientOcclusionLightValue();
        this.aoLightValueScratchYZPN = this.blockAccess.getBlock(p_147808_2_, p_147808_3_, p_147808_4_ - 1).getAmbientOcclusionLightValue();
        this.aoLightValueScratchYZPP = this.blockAccess.getBlock(p_147808_2_, p_147808_3_, p_147808_4_ + 1).getAmbientOcclusionLightValue();
        flag2 = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_ + 1, p_147808_4_).getCanBlockGrass();
        flag3 = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_ + 1, p_147808_4_).getCanBlockGrass();
        flag4 = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ + 1, p_147808_4_ + 1).getCanBlockGrass();
        flag5 = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ + 1, p_147808_4_ - 1).getCanBlockGrass();
        if (!flag5 && !flag3) {
            this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXYNP;
            this.aoBrightnessXYZNPN = this.aoBrightnessXYNP;
        } else {
            this.aoLightValueScratchXYZNPN = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_, p_147808_4_ - 1).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZNPN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ - 1, p_147808_3_, p_147808_4_ - 1);
        }
        if (!flag5 && !flag2) {
            this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXYPP;
            this.aoBrightnessXYZPPN = this.aoBrightnessXYPP;
        } else {
            this.aoLightValueScratchXYZPPN = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_, p_147808_4_ - 1).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZPPN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ + 1, p_147808_3_, p_147808_4_ - 1);
        }
        if (!flag4 && !flag3) {
            this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXYNP;
            this.aoBrightnessXYZNPP = this.aoBrightnessXYNP;
        } else {
            this.aoLightValueScratchXYZNPP = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_, p_147808_4_ + 1).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZNPP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ - 1, p_147808_3_, p_147808_4_ + 1);
        }
        if (!flag4 && !flag2) {
            this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXYPP;
            this.aoBrightnessXYZPPP = this.aoBrightnessXYPP;
        } else {
            this.aoLightValueScratchXYZPPP = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_, p_147808_4_ + 1).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZPPP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ + 1, p_147808_3_, p_147808_4_ + 1);
        }
        if (this.renderMaxY >= 1.0D) {
            --p_147808_3_;
        }
        i1 = l;
        if (this.renderMaxY >= 1.0D || !this.blockAccess.getBlock(p_147808_2_, p_147808_3_ + 1, p_147808_4_).isOpaqueCube()) {
            i1 = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_ + 1, p_147808_4_);
        }
        f7 = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ + 1, p_147808_4_).getAmbientOcclusionLightValue();
        f6 = (this.aoLightValueScratchXYZNPP + this.aoLightValueScratchXYNP + this.aoLightValueScratchYZPP + f7) / 4.0F;
        f3 = (this.aoLightValueScratchYZPP + f7 + this.aoLightValueScratchXYZPPP + this.aoLightValueScratchXYPP) / 4.0F;
        f4 = (f7 + this.aoLightValueScratchYZPN + this.aoLightValueScratchXYPP + this.aoLightValueScratchXYZPPN) / 4.0F;
        f5 = (this.aoLightValueScratchXYNP + this.aoLightValueScratchXYZNPN + f7 + this.aoLightValueScratchYZPN) / 4.0F;
        this.brightnessTopRight = this.getAoBrightness(this.aoBrightnessXYZNPP, this.aoBrightnessXYNP, this.aoBrightnessYZPP, i1);
        this.brightnessTopLeft = this.getAoBrightness(this.aoBrightnessYZPP, this.aoBrightnessXYZPPP, this.aoBrightnessXYPP, i1);
        this.brightnessBottomLeft = this.getAoBrightness(this.aoBrightnessYZPN, this.aoBrightnessXYPP, this.aoBrightnessXYZPPN, i1);
        this.brightnessBottomRight = this.getAoBrightness(this.aoBrightnessXYNP, this.aoBrightnessXYZNPN, this.aoBrightnessYZPN, i1);
        this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = p_147808_5_;
        this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = p_147808_6_;
        this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = p_147808_7_;
        this.colorRedTopLeft *= f3;
        this.colorGreenTopLeft *= f3;
        this.colorBlueTopLeft *= f3;
        this.colorRedBottomLeft *= f4;
        this.colorGreenBottomLeft *= f4;
        this.colorBlueBottomLeft *= f4;
        this.colorRedBottomRight *= f5;
        this.colorGreenBottomRight *= f5;
        this.colorBlueBottomRight *= f5;
        this.colorRedTopRight *= f6;
        this.colorGreenTopRight *= f6;
        this.colorBlueTopRight *= f6;
        this.renderFaceYPos(p_147808_1_, (double) p_147808_2_, (double) p_147808_3_, (double) p_147808_4_, this.getBlockIcon(p_147808_1_, this.blockAccess, p_147808_2_, p_147808_3_, p_147808_4_, 1));
        flag = true;
    }
    float f8;
    float f9;
    float f10;
    float f11;
    int j1;
    int k1;
    int l1;
    int i2;
    IIcon iicon;
    if (this.renderAllFaces || p_147808_1_.shouldSideBeRendered(this.blockAccess, p_147808_2_, p_147808_3_, p_147808_4_ - 1, 2) && limitedSide == 2) {
        if (this.renderMinZ <= 0.0D) {
            --p_147808_4_;
        }
        this.aoLightValueScratchXZNN = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_, p_147808_4_).getAmbientOcclusionLightValue();
        this.aoLightValueScratchYZNN = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ - 1, p_147808_4_).getAmbientOcclusionLightValue();
        this.aoLightValueScratchYZPN = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ + 1, p_147808_4_).getAmbientOcclusionLightValue();
        this.aoLightValueScratchXZPN = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_, p_147808_4_).getAmbientOcclusionLightValue();
        this.aoBrightnessXZNN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ - 1, p_147808_3_, p_147808_4_);
        this.aoBrightnessYZNN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_ - 1, p_147808_4_);
        this.aoBrightnessYZPN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_ + 1, p_147808_4_);
        this.aoBrightnessXZPN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ + 1, p_147808_3_, p_147808_4_);
        flag2 = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_, p_147808_4_ - 1).getCanBlockGrass();
        flag3 = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_, p_147808_4_ - 1).getCanBlockGrass();
        flag4 = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ + 1, p_147808_4_ - 1).getCanBlockGrass();
        flag5 = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ - 1, p_147808_4_ - 1).getCanBlockGrass();
        if (!flag3 && !flag5) {
            this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXZNN;
            this.aoBrightnessXYZNNN = this.aoBrightnessXZNN;
        } else {
            this.aoLightValueScratchXYZNNN = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_ - 1, p_147808_4_).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZNNN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ - 1, p_147808_3_ - 1, p_147808_4_);
        }
        if (!flag3 && !flag4) {
            this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXZNN;
            this.aoBrightnessXYZNPN = this.aoBrightnessXZNN;
        } else {
            this.aoLightValueScratchXYZNPN = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_ + 1, p_147808_4_).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZNPN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ - 1, p_147808_3_ + 1, p_147808_4_);
        }
        if (!flag2 && !flag5) {
            this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXZPN;
            this.aoBrightnessXYZPNN = this.aoBrightnessXZPN;
        } else {
            this.aoLightValueScratchXYZPNN = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_ - 1, p_147808_4_).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZPNN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ + 1, p_147808_3_ - 1, p_147808_4_);
        }
        if (!flag2 && !flag4) {
            this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXZPN;
            this.aoBrightnessXYZPPN = this.aoBrightnessXZPN;
        } else {
            this.aoLightValueScratchXYZPPN = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_ + 1, p_147808_4_).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZPPN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ + 1, p_147808_3_ + 1, p_147808_4_);
        }
        if (this.renderMinZ <= 0.0D) {
            ++p_147808_4_;
        }
        i1 = l;
        if (this.renderMinZ <= 0.0D || !this.blockAccess.getBlock(p_147808_2_, p_147808_3_, p_147808_4_ - 1).isOpaqueCube()) {
            i1 = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_, p_147808_4_ - 1);
        }
        f7 = this.blockAccess.getBlock(p_147808_2_, p_147808_3_, p_147808_4_ - 1).getAmbientOcclusionLightValue();
        f8 = (this.aoLightValueScratchXZNN + this.aoLightValueScratchXYZNPN + f7 + this.aoLightValueScratchYZPN) / 4.0F;
        f9 = (f7 + this.aoLightValueScratchYZPN + this.aoLightValueScratchXZPN + this.aoLightValueScratchXYZPPN) / 4.0F;
        f10 = (this.aoLightValueScratchYZNN + f7 + this.aoLightValueScratchXYZPNN + this.aoLightValueScratchXZPN) / 4.0F;
        f11 = (this.aoLightValueScratchXYZNNN + this.aoLightValueScratchXZNN + this.aoLightValueScratchYZNN + f7) / 4.0F;
        f3 = (float) ((double) f8 * this.renderMaxY * (1.0D - this.renderMinX) + (double) f9 * this.renderMaxY * this.renderMinX + (double) f10 * (1.0D - this.renderMaxY) * this.renderMinX + (double) f11 * (1.0D - this.renderMaxY) * (1.0D - this.renderMinX));
        f4 = (float) ((double) f8 * this.renderMaxY * (1.0D - this.renderMaxX) + (double) f9 * this.renderMaxY * this.renderMaxX + (double) f10 * (1.0D - this.renderMaxY) * this.renderMaxX + (double) f11 * (1.0D - this.renderMaxY) * (1.0D - this.renderMaxX));
        f5 = (float) ((double) f8 * this.renderMinY * (1.0D - this.renderMaxX) + (double) f9 * this.renderMinY * this.renderMaxX + (double) f10 * (1.0D - this.renderMinY) * this.renderMaxX + (double) f11 * (1.0D - this.renderMinY) * (1.0D - this.renderMaxX));
        f6 = (float) ((double) f8 * this.renderMinY * (1.0D - this.renderMinX) + (double) f9 * this.renderMinY * this.renderMinX + (double) f10 * (1.0D - this.renderMinY) * this.renderMinX + (double) f11 * (1.0D - this.renderMinY) * (1.0D - this.renderMinX));
        j1 = this.getAoBrightness(this.aoBrightnessXZNN, this.aoBrightnessXYZNPN, this.aoBrightnessYZPN, i1);
        k1 = this.getAoBrightness(this.aoBrightnessYZPN, this.aoBrightnessXZPN, this.aoBrightnessXYZPPN, i1);
        l1 = this.getAoBrightness(this.aoBrightnessYZNN, this.aoBrightnessXYZPNN, this.aoBrightnessXZPN, i1);
        i2 = this.getAoBrightness(this.aoBrightnessXYZNNN, this.aoBrightnessXZNN, this.aoBrightnessYZNN, i1);
        this.brightnessTopLeft = this.mixAoBrightness(j1, k1, l1, i2, this.renderMaxY * (1.0D - this.renderMinX), this.renderMaxY * this.renderMinX, (1.0D - this.renderMaxY) * this.renderMinX, (1.0D - this.renderMaxY) * (1.0D - this.renderMinX));
        this.brightnessBottomLeft = this.mixAoBrightness(j1, k1, l1, i2, this.renderMaxY * (1.0D - this.renderMaxX), this.renderMaxY * this.renderMaxX, (1.0D - this.renderMaxY) * this.renderMaxX, (1.0D - this.renderMaxY) * (1.0D - this.renderMaxX));
        this.brightnessBottomRight = this.mixAoBrightness(j1, k1, l1, i2, this.renderMinY * (1.0D - this.renderMaxX), this.renderMinY * this.renderMaxX, (1.0D - this.renderMinY) * this.renderMaxX, (1.0D - this.renderMinY) * (1.0D - this.renderMaxX));
        this.brightnessTopRight = this.mixAoBrightness(j1, k1, l1, i2, this.renderMinY * (1.0D - this.renderMinX), this.renderMinY * this.renderMinX, (1.0D - this.renderMinY) * this.renderMinX, (1.0D - this.renderMinY) * (1.0D - this.renderMinX));
        if (flag1) {
            this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = p_147808_5_ * 0.8F;
            this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = p_147808_6_ * 0.8F;
            this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = p_147808_7_ * 0.8F;
        } else {
            this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.8F;
            this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.8F;
            this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.8F;
        }
        this.colorRedTopLeft *= f3;
        this.colorGreenTopLeft *= f3;
        this.colorBlueTopLeft *= f3;
        this.colorRedBottomLeft *= f4;
        this.colorGreenBottomLeft *= f4;
        this.colorBlueBottomLeft *= f4;
        this.colorRedBottomRight *= f5;
        this.colorGreenBottomRight *= f5;
        this.colorBlueBottomRight *= f5;
        this.colorRedTopRight *= f6;
        this.colorGreenTopRight *= f6;
        this.colorBlueTopRight *= f6;
        iicon = this.getBlockIcon(p_147808_1_, this.blockAccess, p_147808_2_, p_147808_3_, p_147808_4_, 2);
        this.renderFaceZNeg(p_147808_1_, (double) p_147808_2_, (double) p_147808_3_, (double) p_147808_4_, iicon);
        if (fancyGrass && iicon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) {
            this.colorRedTopLeft *= p_147808_5_;
            this.colorRedBottomLeft *= p_147808_5_;
            this.colorRedBottomRight *= p_147808_5_;
            this.colorRedTopRight *= p_147808_5_;
            this.colorGreenTopLeft *= p_147808_6_;
            this.colorGreenBottomLeft *= p_147808_6_;
            this.colorGreenBottomRight *= p_147808_6_;
            this.colorGreenTopRight *= p_147808_6_;
            this.colorBlueTopLeft *= p_147808_7_;
            this.colorBlueBottomLeft *= p_147808_7_;
            this.colorBlueBottomRight *= p_147808_7_;
            this.colorBlueTopRight *= p_147808_7_;
            this.renderFaceZNeg(p_147808_1_, (double) p_147808_2_, (double) p_147808_3_, (double) p_147808_4_, BlockGrass.getIconSideOverlay());
        }
        flag = true;
    }
    if (this.renderAllFaces || p_147808_1_.shouldSideBeRendered(this.blockAccess, p_147808_2_, p_147808_3_, p_147808_4_ + 1, 3) && limitedSide == 3) {
        if (this.renderMaxZ >= 1.0D) {
            ++p_147808_4_;
        }
        this.aoLightValueScratchXZNP = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_, p_147808_4_).getAmbientOcclusionLightValue();
        this.aoLightValueScratchXZPP = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_, p_147808_4_).getAmbientOcclusionLightValue();
        this.aoLightValueScratchYZNP = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ - 1, p_147808_4_).getAmbientOcclusionLightValue();
        this.aoLightValueScratchYZPP = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ + 1, p_147808_4_).getAmbientOcclusionLightValue();
        this.aoBrightnessXZNP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ - 1, p_147808_3_, p_147808_4_);
        this.aoBrightnessXZPP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ + 1, p_147808_3_, p_147808_4_);
        this.aoBrightnessYZNP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_ - 1, p_147808_4_);
        this.aoBrightnessYZPP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_ + 1, p_147808_4_);
        flag2 = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_, p_147808_4_ + 1).getCanBlockGrass();
        flag3 = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_, p_147808_4_ + 1).getCanBlockGrass();
        flag4 = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ + 1, p_147808_4_ + 1).getCanBlockGrass();
        flag5 = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ - 1, p_147808_4_ + 1).getCanBlockGrass();
        if (!flag3 && !flag5) {
            this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXZNP;
            this.aoBrightnessXYZNNP = this.aoBrightnessXZNP;
        } else {
            this.aoLightValueScratchXYZNNP = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_ - 1, p_147808_4_).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZNNP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ - 1, p_147808_3_ - 1, p_147808_4_);
        }
        if (!flag3 && !flag4) {
            this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXZNP;
            this.aoBrightnessXYZNPP = this.aoBrightnessXZNP;
        } else {
            this.aoLightValueScratchXYZNPP = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_ + 1, p_147808_4_).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZNPP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ - 1, p_147808_3_ + 1, p_147808_4_);
        }
        if (!flag2 && !flag5) {
            this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXZPP;
            this.aoBrightnessXYZPNP = this.aoBrightnessXZPP;
        } else {
            this.aoLightValueScratchXYZPNP = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_ - 1, p_147808_4_).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZPNP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ + 1, p_147808_3_ - 1, p_147808_4_);
        }
        if (!flag2 && !flag4) {
            this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXZPP;
            this.aoBrightnessXYZPPP = this.aoBrightnessXZPP;
        } else {
            this.aoLightValueScratchXYZPPP = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_ + 1, p_147808_4_).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZPPP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ + 1, p_147808_3_ + 1, p_147808_4_);
        }
        if (this.renderMaxZ >= 1.0D) {
            --p_147808_4_;
        }
        i1 = l;
        if (this.renderMaxZ >= 1.0D || !this.blockAccess.getBlock(p_147808_2_, p_147808_3_, p_147808_4_ + 1).isOpaqueCube()) {
            i1 = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_, p_147808_4_ + 1);
        }
        f7 = this.blockAccess.getBlock(p_147808_2_, p_147808_3_, p_147808_4_ + 1).getAmbientOcclusionLightValue();
        f8 = (this.aoLightValueScratchXZNP + this.aoLightValueScratchXYZNPP + f7 + this.aoLightValueScratchYZPP) / 4.0F;
        f9 = (f7 + this.aoLightValueScratchYZPP + this.aoLightValueScratchXZPP + this.aoLightValueScratchXYZPPP) / 4.0F;
        f10 = (this.aoLightValueScratchYZNP + f7 + this.aoLightValueScratchXYZPNP + this.aoLightValueScratchXZPP) / 4.0F;
        f11 = (this.aoLightValueScratchXYZNNP + this.aoLightValueScratchXZNP + this.aoLightValueScratchYZNP + f7) / 4.0F;
        f3 = (float) ((double) f8 * this.renderMaxY * (1.0D - this.renderMinX) + (double) f9 * this.renderMaxY * this.renderMinX + (double) f10 * (1.0D - this.renderMaxY) * this.renderMinX + (double) f11 * (1.0D - this.renderMaxY) * (1.0D - this.renderMinX));
        f4 = (float) ((double) f8 * this.renderMinY * (1.0D - this.renderMinX) + (double) f9 * this.renderMinY * this.renderMinX + (double) f10 * (1.0D - this.renderMinY) * this.renderMinX + (double) f11 * (1.0D - this.renderMinY) * (1.0D - this.renderMinX));
        f5 = (float) ((double) f8 * this.renderMinY * (1.0D - this.renderMaxX) + (double) f9 * this.renderMinY * this.renderMaxX + (double) f10 * (1.0D - this.renderMinY) * this.renderMaxX + (double) f11 * (1.0D - this.renderMinY) * (1.0D - this.renderMaxX));
        f6 = (float) ((double) f8 * this.renderMaxY * (1.0D - this.renderMaxX) + (double) f9 * this.renderMaxY * this.renderMaxX + (double) f10 * (1.0D - this.renderMaxY) * this.renderMaxX + (double) f11 * (1.0D - this.renderMaxY) * (1.0D - this.renderMaxX));
        j1 = this.getAoBrightness(this.aoBrightnessXZNP, this.aoBrightnessXYZNPP, this.aoBrightnessYZPP, i1);
        k1 = this.getAoBrightness(this.aoBrightnessYZPP, this.aoBrightnessXZPP, this.aoBrightnessXYZPPP, i1);
        l1 = this.getAoBrightness(this.aoBrightnessYZNP, this.aoBrightnessXYZPNP, this.aoBrightnessXZPP, i1);
        i2 = this.getAoBrightness(this.aoBrightnessXYZNNP, this.aoBrightnessXZNP, this.aoBrightnessYZNP, i1);
        this.brightnessTopLeft = this.mixAoBrightness(j1, i2, l1, k1, this.renderMaxY * (1.0D - this.renderMinX), (1.0D - this.renderMaxY) * (1.0D - this.renderMinX), (1.0D - this.renderMaxY) * this.renderMinX, this.renderMaxY * this.renderMinX);
        this.brightnessBottomLeft = this.mixAoBrightness(j1, i2, l1, k1, this.renderMinY * (1.0D - this.renderMinX), (1.0D - this.renderMinY) * (1.0D - this.renderMinX), (1.0D - this.renderMinY) * this.renderMinX, this.renderMinY * this.renderMinX);
        this.brightnessBottomRight = this.mixAoBrightness(j1, i2, l1, k1, this.renderMinY * (1.0D - this.renderMaxX), (1.0D - this.renderMinY) * (1.0D - this.renderMaxX), (1.0D - this.renderMinY) * this.renderMaxX, this.renderMinY * this.renderMaxX);
        this.brightnessTopRight = this.mixAoBrightness(j1, i2, l1, k1, this.renderMaxY * (1.0D - this.renderMaxX), (1.0D - this.renderMaxY) * (1.0D - this.renderMaxX), (1.0D - this.renderMaxY) * this.renderMaxX, this.renderMaxY * this.renderMaxX);
        if (flag1) {
            this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = p_147808_5_ * 0.8F;
            this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = p_147808_6_ * 0.8F;
            this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = p_147808_7_ * 0.8F;
        } else {
            this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.8F;
            this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.8F;
            this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.8F;
        }
        this.colorRedTopLeft *= f3;
        this.colorGreenTopLeft *= f3;
        this.colorBlueTopLeft *= f3;
        this.colorRedBottomLeft *= f4;
        this.colorGreenBottomLeft *= f4;
        this.colorBlueBottomLeft *= f4;
        this.colorRedBottomRight *= f5;
        this.colorGreenBottomRight *= f5;
        this.colorBlueBottomRight *= f5;
        this.colorRedTopRight *= f6;
        this.colorGreenTopRight *= f6;
        this.colorBlueTopRight *= f6;
        iicon = this.getBlockIcon(p_147808_1_, this.blockAccess, p_147808_2_, p_147808_3_, p_147808_4_, 3);
        this.renderFaceZPos(p_147808_1_, (double) p_147808_2_, (double) p_147808_3_, (double) p_147808_4_, iicon);
        if (fancyGrass && iicon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) {
            this.colorRedTopLeft *= p_147808_5_;
            this.colorRedBottomLeft *= p_147808_5_;
            this.colorRedBottomRight *= p_147808_5_;
            this.colorRedTopRight *= p_147808_5_;
            this.colorGreenTopLeft *= p_147808_6_;
            this.colorGreenBottomLeft *= p_147808_6_;
            this.colorGreenBottomRight *= p_147808_6_;
            this.colorGreenTopRight *= p_147808_6_;
            this.colorBlueTopLeft *= p_147808_7_;
            this.colorBlueBottomLeft *= p_147808_7_;
            this.colorBlueBottomRight *= p_147808_7_;
            this.colorBlueTopRight *= p_147808_7_;
            this.renderFaceZPos(p_147808_1_, (double) p_147808_2_, (double) p_147808_3_, (double) p_147808_4_, BlockGrass.getIconSideOverlay());
        }
        flag = true;
    }
    if (this.renderAllFaces || p_147808_1_.shouldSideBeRendered(this.blockAccess, p_147808_2_ - 1, p_147808_3_, p_147808_4_, 4) && limitedSide == 4) {
        if (this.renderMinX <= 0.0D) {
            --p_147808_2_;
        }
        this.aoLightValueScratchXYNN = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ - 1, p_147808_4_).getAmbientOcclusionLightValue();
        this.aoLightValueScratchXZNN = this.blockAccess.getBlock(p_147808_2_, p_147808_3_, p_147808_4_ - 1).getAmbientOcclusionLightValue();
        this.aoLightValueScratchXZNP = this.blockAccess.getBlock(p_147808_2_, p_147808_3_, p_147808_4_ + 1).getAmbientOcclusionLightValue();
        this.aoLightValueScratchXYNP = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ + 1, p_147808_4_).getAmbientOcclusionLightValue();
        this.aoBrightnessXYNN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_ - 1, p_147808_4_);
        this.aoBrightnessXZNN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_, p_147808_4_ - 1);
        this.aoBrightnessXZNP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_, p_147808_4_ + 1);
        this.aoBrightnessXYNP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_ + 1, p_147808_4_);
        flag2 = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_ + 1, p_147808_4_).getCanBlockGrass();
        flag3 = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_ - 1, p_147808_4_).getCanBlockGrass();
        flag4 = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_, p_147808_4_ - 1).getCanBlockGrass();
        flag5 = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_, p_147808_4_ + 1).getCanBlockGrass();
        if (!flag4 && !flag3) {
            this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXZNN;
            this.aoBrightnessXYZNNN = this.aoBrightnessXZNN;
        } else {
            this.aoLightValueScratchXYZNNN = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ - 1, p_147808_4_ - 1).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZNNN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_ - 1, p_147808_4_ - 1);
        }
        if (!flag5 && !flag3) {
            this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXZNP;
            this.aoBrightnessXYZNNP = this.aoBrightnessXZNP;
        } else {
            this.aoLightValueScratchXYZNNP = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ - 1, p_147808_4_ + 1).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZNNP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_ - 1, p_147808_4_ + 1);
        }
        if (!flag4 && !flag2) {
            this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXZNN;
            this.aoBrightnessXYZNPN = this.aoBrightnessXZNN;
        } else {
            this.aoLightValueScratchXYZNPN = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ + 1, p_147808_4_ - 1).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZNPN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_ + 1, p_147808_4_ - 1);
        }
        if (!flag5 && !flag2) {
            this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXZNP;
            this.aoBrightnessXYZNPP = this.aoBrightnessXZNP;
        } else {
            this.aoLightValueScratchXYZNPP = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ + 1, p_147808_4_ + 1).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZNPP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_ + 1, p_147808_4_ + 1);
        }
        if (this.renderMinX <= 0.0D) {
            ++p_147808_2_;
        }
        i1 = l;
        if (this.renderMinX <= 0.0D || !this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_, p_147808_4_).isOpaqueCube()) {
            i1 = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ - 1, p_147808_3_, p_147808_4_);
        }
        f7 = this.blockAccess.getBlock(p_147808_2_ - 1, p_147808_3_, p_147808_4_).getAmbientOcclusionLightValue();
        f8 = (this.aoLightValueScratchXYNN + this.aoLightValueScratchXYZNNP + f7 + this.aoLightValueScratchXZNP) / 4.0F;
        f9 = (f7 + this.aoLightValueScratchXZNP + this.aoLightValueScratchXYNP + this.aoLightValueScratchXYZNPP) / 4.0F;
        f10 = (this.aoLightValueScratchXZNN + f7 + this.aoLightValueScratchXYZNPN + this.aoLightValueScratchXYNP) / 4.0F;
        f11 = (this.aoLightValueScratchXYZNNN + this.aoLightValueScratchXYNN + this.aoLightValueScratchXZNN + f7) / 4.0F;
        f3 = (float) ((double) f9 * this.renderMaxY * this.renderMaxZ + (double) f10 * this.renderMaxY * (1.0D - this.renderMaxZ) + (double) f11 * (1.0D - this.renderMaxY) * (1.0D - this.renderMaxZ) + (double) f8 * (1.0D - this.renderMaxY) * this.renderMaxZ);
        f4 = (float) ((double) f9 * this.renderMaxY * this.renderMinZ + (double) f10 * this.renderMaxY * (1.0D - this.renderMinZ) + (double) f11 * (1.0D - this.renderMaxY) * (1.0D - this.renderMinZ) + (double) f8 * (1.0D - this.renderMaxY) * this.renderMinZ);
        f5 = (float) ((double) f9 * this.renderMinY * this.renderMinZ + (double) f10 * this.renderMinY * (1.0D - this.renderMinZ) + (double) f11 * (1.0D - this.renderMinY) * (1.0D - this.renderMinZ) + (double) f8 * (1.0D - this.renderMinY) * this.renderMinZ);
        f6 = (float) ((double) f9 * this.renderMinY * this.renderMaxZ + (double) f10 * this.renderMinY * (1.0D - this.renderMaxZ) + (double) f11 * (1.0D - this.renderMinY) * (1.0D - this.renderMaxZ) + (double) f8 * (1.0D - this.renderMinY) * this.renderMaxZ);
        j1 = this.getAoBrightness(this.aoBrightnessXYNN, this.aoBrightnessXYZNNP, this.aoBrightnessXZNP, i1);
        k1 = this.getAoBrightness(this.aoBrightnessXZNP, this.aoBrightnessXYNP, this.aoBrightnessXYZNPP, i1);
        l1 = this.getAoBrightness(this.aoBrightnessXZNN, this.aoBrightnessXYZNPN, this.aoBrightnessXYNP, i1);
        i2 = this.getAoBrightness(this.aoBrightnessXYZNNN, this.aoBrightnessXYNN, this.aoBrightnessXZNN, i1);
        this.brightnessTopLeft = this.mixAoBrightness(k1, l1, i2, j1, this.renderMaxY * this.renderMaxZ, this.renderMaxY * (1.0D - this.renderMaxZ), (1.0D - this.renderMaxY) * (1.0D - this.renderMaxZ), (1.0D - this.renderMaxY) * this.renderMaxZ);
        this.brightnessBottomLeft = this.mixAoBrightness(k1, l1, i2, j1, this.renderMaxY * this.renderMinZ, this.renderMaxY * (1.0D - this.renderMinZ), (1.0D - this.renderMaxY) * (1.0D - this.renderMinZ), (1.0D - this.renderMaxY) * this.renderMinZ);
        this.brightnessBottomRight = this.mixAoBrightness(k1, l1, i2, j1, this.renderMinY * this.renderMinZ, this.renderMinY * (1.0D - this.renderMinZ), (1.0D - this.renderMinY) * (1.0D - this.renderMinZ), (1.0D - this.renderMinY) * this.renderMinZ);
        this.brightnessTopRight = this.mixAoBrightness(k1, l1, i2, j1, this.renderMinY * this.renderMaxZ, this.renderMinY * (1.0D - this.renderMaxZ), (1.0D - this.renderMinY) * (1.0D - this.renderMaxZ), (1.0D - this.renderMinY) * this.renderMaxZ);
        if (flag1) {
            this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = p_147808_5_ * 0.6F;
            this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = p_147808_6_ * 0.6F;
            this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = p_147808_7_ * 0.6F;
        } else {
            this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.6F;
            this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.6F;
            this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.6F;
        }
        this.colorRedTopLeft *= f3;
        this.colorGreenTopLeft *= f3;
        this.colorBlueTopLeft *= f3;
        this.colorRedBottomLeft *= f4;
        this.colorGreenBottomLeft *= f4;
        this.colorBlueBottomLeft *= f4;
        this.colorRedBottomRight *= f5;
        this.colorGreenBottomRight *= f5;
        this.colorBlueBottomRight *= f5;
        this.colorRedTopRight *= f6;
        this.colorGreenTopRight *= f6;
        this.colorBlueTopRight *= f6;
        iicon = this.getBlockIcon(p_147808_1_, this.blockAccess, p_147808_2_, p_147808_3_, p_147808_4_, 4);
        this.renderFaceXNeg(p_147808_1_, (double) p_147808_2_, (double) p_147808_3_, (double) p_147808_4_, iicon);
        if (fancyGrass && iicon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) {
            this.colorRedTopLeft *= p_147808_5_;
            this.colorRedBottomLeft *= p_147808_5_;
            this.colorRedBottomRight *= p_147808_5_;
            this.colorRedTopRight *= p_147808_5_;
            this.colorGreenTopLeft *= p_147808_6_;
            this.colorGreenBottomLeft *= p_147808_6_;
            this.colorGreenBottomRight *= p_147808_6_;
            this.colorGreenTopRight *= p_147808_6_;
            this.colorBlueTopLeft *= p_147808_7_;
            this.colorBlueBottomLeft *= p_147808_7_;
            this.colorBlueBottomRight *= p_147808_7_;
            this.colorBlueTopRight *= p_147808_7_;
            this.renderFaceXNeg(p_147808_1_, (double) p_147808_2_, (double) p_147808_3_, (double) p_147808_4_, BlockGrass.getIconSideOverlay());
        }
        flag = true;
    }
    if (this.renderAllFaces || p_147808_1_.shouldSideBeRendered(this.blockAccess, p_147808_2_ + 1, p_147808_3_, p_147808_4_, 5) && limitedSide == 5) {
        if (this.renderMaxX >= 1.0D) {
            ++p_147808_2_;
        }
        this.aoLightValueScratchXYPN = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ - 1, p_147808_4_).getAmbientOcclusionLightValue();
        this.aoLightValueScratchXZPN = this.blockAccess.getBlock(p_147808_2_, p_147808_3_, p_147808_4_ - 1).getAmbientOcclusionLightValue();
        this.aoLightValueScratchXZPP = this.blockAccess.getBlock(p_147808_2_, p_147808_3_, p_147808_4_ + 1).getAmbientOcclusionLightValue();
        this.aoLightValueScratchXYPP = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ + 1, p_147808_4_).getAmbientOcclusionLightValue();
        this.aoBrightnessXYPN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_ - 1, p_147808_4_);
        this.aoBrightnessXZPN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_, p_147808_4_ - 1);
        this.aoBrightnessXZPP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_, p_147808_4_ + 1);
        this.aoBrightnessXYPP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_ + 1, p_147808_4_);
        flag2 = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_ + 1, p_147808_4_).getCanBlockGrass();
        flag3 = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_ - 1, p_147808_4_).getCanBlockGrass();
        flag4 = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_, p_147808_4_ + 1).getCanBlockGrass();
        flag5 = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_, p_147808_4_ - 1).getCanBlockGrass();
        if (!flag3 && !flag5) {
            this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXZPN;
            this.aoBrightnessXYZPNN = this.aoBrightnessXZPN;
        } else {
            this.aoLightValueScratchXYZPNN = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ - 1, p_147808_4_ - 1).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZPNN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_ - 1, p_147808_4_ - 1);
        }
        if (!flag3 && !flag4) {
            this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXZPP;
            this.aoBrightnessXYZPNP = this.aoBrightnessXZPP;
        } else {
            this.aoLightValueScratchXYZPNP = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ - 1, p_147808_4_ + 1).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZPNP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_ - 1, p_147808_4_ + 1);
        }
        if (!flag2 && !flag5) {
            this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXZPN;
            this.aoBrightnessXYZPPN = this.aoBrightnessXZPN;
        } else {
            this.aoLightValueScratchXYZPPN = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ + 1, p_147808_4_ - 1).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZPPN = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_ + 1, p_147808_4_ - 1);
        }
        if (!flag2 && !flag4) {
            this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXZPP;
            this.aoBrightnessXYZPPP = this.aoBrightnessXZPP;
        } else {
            this.aoLightValueScratchXYZPPP = this.blockAccess.getBlock(p_147808_2_, p_147808_3_ + 1, p_147808_4_ + 1).getAmbientOcclusionLightValue();
            this.aoBrightnessXYZPPP = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_, p_147808_3_ + 1, p_147808_4_ + 1);
        }
        if (this.renderMaxX >= 1.0D) {
            --p_147808_2_;
        }
        i1 = l;
        if (this.renderMaxX >= 1.0D || !this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_, p_147808_4_).isOpaqueCube()) {
            i1 = p_147808_1_.getMixedBrightnessForBlock(this.blockAccess, p_147808_2_ + 1, p_147808_3_, p_147808_4_);
        }
        f7 = this.blockAccess.getBlock(p_147808_2_ + 1, p_147808_3_, p_147808_4_).getAmbientOcclusionLightValue();
        f8 = (this.aoLightValueScratchXYPN + this.aoLightValueScratchXYZPNP + f7 + this.aoLightValueScratchXZPP) / 4.0F;
        f9 = (this.aoLightValueScratchXYZPNN + this.aoLightValueScratchXYPN + this.aoLightValueScratchXZPN + f7) / 4.0F;
        f10 = (this.aoLightValueScratchXZPN + f7 + this.aoLightValueScratchXYZPPN + this.aoLightValueScratchXYPP) / 4.0F;
        f11 = (f7 + this.aoLightValueScratchXZPP + this.aoLightValueScratchXYPP + this.aoLightValueScratchXYZPPP) / 4.0F;
        f3 = (float) ((double) f8 * (1.0D - this.renderMinY) * this.renderMaxZ + (double) f9 * (1.0D - this.renderMinY) * (1.0D - this.renderMaxZ) + (double) f10 * this.renderMinY * (1.0D - this.renderMaxZ) + (double) f11 * this.renderMinY * this.renderMaxZ);
        f4 = (float) ((double) f8 * (1.0D - this.renderMinY) * this.renderMinZ + (double) f9 * (1.0D - this.renderMinY) * (1.0D - this.renderMinZ) + (double) f10 * this.renderMinY * (1.0D - this.renderMinZ) + (double) f11 * this.renderMinY * this.renderMinZ);
        f5 = (float) ((double) f8 * (1.0D - this.renderMaxY) * this.renderMinZ + (double) f9 * (1.0D - this.renderMaxY) * (1.0D - this.renderMinZ) + (double) f10 * this.renderMaxY * (1.0D - this.renderMinZ) + (double) f11 * this.renderMaxY * this.renderMinZ);
        f6 = (float) ((double) f8 * (1.0D - this.renderMaxY) * this.renderMaxZ + (double) f9 * (1.0D - this.renderMaxY) * (1.0D - this.renderMaxZ) + (double) f10 * this.renderMaxY * (1.0D - this.renderMaxZ) + (double) f11 * this.renderMaxY * this.renderMaxZ);
        j1 = this.getAoBrightness(this.aoBrightnessXYPN, this.aoBrightnessXYZPNP, this.aoBrightnessXZPP, i1);
        k1 = this.getAoBrightness(this.aoBrightnessXZPP, this.aoBrightnessXYPP, this.aoBrightnessXYZPPP, i1);
        l1 = this.getAoBrightness(this.aoBrightnessXZPN, this.aoBrightnessXYZPPN, this.aoBrightnessXYPP, i1);
        i2 = this.getAoBrightness(this.aoBrightnessXYZPNN, this.aoBrightnessXYPN, this.aoBrightnessXZPN, i1);
        this.brightnessTopLeft = this.mixAoBrightness(j1, i2, l1, k1, (1.0D - this.renderMinY) * this.renderMaxZ, (1.0D - this.renderMinY) * (1.0D - this.renderMaxZ), this.renderMinY * (1.0D - this.renderMaxZ), this.renderMinY * this.renderMaxZ);
        this.brightnessBottomLeft = this.mixAoBrightness(j1, i2, l1, k1, (1.0D - this.renderMinY) * this.renderMinZ, (1.0D - this.renderMinY) * (1.0D - this.renderMinZ), this.renderMinY * (1.0D - this.renderMinZ), this.renderMinY * this.renderMinZ);
        this.brightnessBottomRight = this.mixAoBrightness(j1, i2, l1, k1, (1.0D - this.renderMaxY) * this.renderMinZ, (1.0D - this.renderMaxY) * (1.0D - this.renderMinZ), this.renderMaxY * (1.0D - this.renderMinZ), this.renderMaxY * this.renderMinZ);
        this.brightnessTopRight = this.mixAoBrightness(j1, i2, l1, k1, (1.0D - this.renderMaxY) * this.renderMaxZ, (1.0D - this.renderMaxY) * (1.0D - this.renderMaxZ), this.renderMaxY * (1.0D - this.renderMaxZ), this.renderMaxY * this.renderMaxZ);
        if (flag1) {
            this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = p_147808_5_ * 0.6F;
            this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = p_147808_6_ * 0.6F;
            this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = p_147808_7_ * 0.6F;
        } else {
            this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.6F;
            this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.6F;
            this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.6F;
        }
        this.colorRedTopLeft *= f3;
        this.colorGreenTopLeft *= f3;
        this.colorBlueTopLeft *= f3;
        this.colorRedBottomLeft *= f4;
        this.colorGreenBottomLeft *= f4;
        this.colorBlueBottomLeft *= f4;
        this.colorRedBottomRight *= f5;
        this.colorGreenBottomRight *= f5;
        this.colorBlueBottomRight *= f5;
        this.colorRedTopRight *= f6;
        this.colorGreenTopRight *= f6;
        this.colorBlueTopRight *= f6;
        iicon = this.getBlockIcon(p_147808_1_, this.blockAccess, p_147808_2_, p_147808_3_, p_147808_4_, 5);
        this.renderFaceXPos(p_147808_1_, (double) p_147808_2_, (double) p_147808_3_, (double) p_147808_4_, iicon);
        if (fancyGrass && iicon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) {
            this.colorRedTopLeft *= p_147808_5_;
            this.colorRedBottomLeft *= p_147808_5_;
            this.colorRedBottomRight *= p_147808_5_;
            this.colorRedTopRight *= p_147808_5_;
            this.colorGreenTopLeft *= p_147808_6_;
            this.colorGreenBottomLeft *= p_147808_6_;
            this.colorGreenBottomRight *= p_147808_6_;
            this.colorGreenTopRight *= p_147808_6_;
            this.colorBlueTopLeft *= p_147808_7_;
            this.colorBlueBottomLeft *= p_147808_7_;
            this.colorBlueBottomRight *= p_147808_7_;
            this.colorBlueTopRight *= p_147808_7_;
            this.renderFaceXPos(p_147808_1_, (double) p_147808_2_, (double) p_147808_3_, (double) p_147808_4_, BlockGrass.getIconSideOverlay());
        }
        flag = true;
    }
    this.enableAO = false;
    return flag;
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) IIcon(net.minecraft.util.IIcon)

Example 43 with IIcon

use of net.minecraft.util.IIcon in project BetterStorage by copygirl.

the class TileEntityPresentRenderer method renderSome.

private void renderSome(int color, int... layers) {
    IIcon icon = ((color < 16) ? Blocks.wool.getIcon(0, color) : Blocks.gold_block.getIcon(0, 0));
    GL11.glMatrixMode(GL11.GL_TEXTURE);
    GL11.glPushMatrix();
    GL11.glTranslatef(icon.getMinU(), icon.getMinV(), 0);
    GL11.glScalef((icon.getMaxU() - icon.getMinU()), (icon.getMaxV() - icon.getMinV()), 1);
    for (int i = 0; i < layers.length; i++) model.render(layers[i]);
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
Also used : IIcon(net.minecraft.util.IIcon)

Example 44 with IIcon

use of net.minecraft.util.IIcon in project BetterStorage by copygirl.

the class TileLockableDoor method getIcon.

@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int face) {
    int meta = world.getBlockMetadata(x, y, z);
    if (meta > 0)
        y -= 1;
    TileEntityLockableDoor lockable = WorldUtils.get(world, x, y, z, TileEntityLockableDoor.class);
    boolean flip = false;
    IIcon icon = iconUpper;
    if (meta == 0 || face == 1) {
        icon = iconLower;
    }
    switch(lockable.orientation) {
        case WEST:
            if (face == 3 && !lockable.isOpen)
                flip = true;
            else if (face == 2 && lockable.isOpen)
                flip = true;
            break;
        case EAST:
            if (face == 4 && !lockable.isOpen)
                flip = true;
            else if (face == 3 && lockable.isOpen)
                flip = true;
            break;
        case SOUTH:
            if (face == 2 && !lockable.isOpen)
                flip = true;
            else if (face == 4 && lockable.isOpen)
                flip = true;
            break;
        default:
            if (face == 3 && !lockable.isOpen)
                flip = true;
            else if (face == 5 && lockable.isOpen)
                flip = true;
            break;
    }
    icon = flip ? (icon == iconLower ? iconLowerFlipped : iconUpperFlipped) : icon;
    return icon;
}
Also used : IIcon(net.minecraft.util.IIcon) TileEntityLockableDoor(net.mcft.copy.betterstorage.tile.entity.TileEntityLockableDoor)

Example 45 with IIcon

use of net.minecraft.util.IIcon in project BetterStorage by copygirl.

the class RenderUtils method renderItemIn3d.

public static void renderItemIn3d(ItemStack stack) {
    TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
    // Not sure why but this can be null when the world loads.
    if (textureManager == null)
        return;
    Item item = stack.getItem();
    GL11.glPushMatrix();
    Tessellator tessellator = Tessellator.instance;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glTranslatef(-0.5F, -0.5F, 1 / 32.0F);
    int passes = item.getRenderPasses(stack.getItemDamage());
    for (int pass = 0; pass < passes; pass++) {
        textureManager.bindTexture(((stack.getItemSpriteNumber() == 0) ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture));
        IIcon icon = item.getIcon(stack, pass);
        float minU = icon.getMinU();
        float maxU = icon.getMaxU();
        float minV = icon.getMinV();
        float maxV = icon.getMaxV();
        RenderUtils.setColorFromInt(item.getColorFromItemStack(stack, pass));
        ItemRenderer.renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
    }
    if (stack.hasEffect(0)) {
        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDisable(GL11.GL_LIGHTING);
        textureManager.bindTexture(glint);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
        float f7 = 0.76F;
        GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glPushMatrix();
        float f8 = 0.125F;
        GL11.glScalef(f8, f8, f8);
        float f9 = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F;
        GL11.glTranslatef(f9, 0.0F, 0.0F);
        GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
        ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(f8, f8, f8);
        f9 = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F;
        GL11.glTranslatef(-f9, 0.0F, 0.0F);
        GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
        ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
        GL11.glPopMatrix();
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
    }
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}
Also used : Item(net.minecraft.item.Item) TextureManager(net.minecraft.client.renderer.texture.TextureManager) Tessellator(net.minecraft.client.renderer.Tessellator) IIcon(net.minecraft.util.IIcon)

Aggregations

IIcon (net.minecraft.util.IIcon)79 Tessellator (net.minecraft.client.renderer.Tessellator)19 SideOnly (cpw.mods.fml.relauncher.SideOnly)17 Vec3dCube (uk.co.qmunity.lib.vec.Vec3dCube)11 ItemStack (net.minecraft.item.ItemStack)6 EntityItem (net.minecraft.entity.item.EntityItem)5 Fluid (net.minecraftforge.fluids.Fluid)5 Rotation (uk.co.qmunity.lib.transform.Rotation)5 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)4 AMVector2 (am2.api.math.AMVector2)3 Block (net.minecraft.block.Block)3 EntityDiggingFX (net.minecraft.client.particle.EntityDiggingFX)3 TubeColor (com.bluepowermod.api.tube.IPneumaticTube.TubeColor)2 IExplosiveHandler (com.builtbroken.mc.api.explosive.IExplosiveHandler)2 ITexturedExplosiveHandler (com.builtbroken.mc.api.explosive.ITexturedExplosiveHandler)2 IExplosiveContainerItem (com.builtbroken.mc.api.items.explosives.IExplosiveContainerItem)2 ItemStackWrapper (com.builtbroken.mc.prefab.items.ItemStackWrapper)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 FluidStack (net.minecraftforge.fluids.FluidStack)2 DoubleCoordinates (network.rs485.logisticspipes.world.DoubleCoordinates)2