Java Code Examples for net.minecraft.client.Minecraft#isAmbientOcclusionEnabled()

The following examples show how to use net.minecraft.client.Minecraft#isAmbientOcclusionEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MetaTileEntityTESR.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void renderTileEntityFastPart(MetaTileEntityHolder te, double x, double y, double z, float partialTicks, int destroyStage) {
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buffer = tessellator.getBuffer();
    this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    RenderHelper.disableStandardItemLighting();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.enableBlend();
    GlStateManager.disableCull();

    if (Minecraft.isAmbientOcclusionEnabled()) {
        GlStateManager.shadeModel(GL11.GL_SMOOTH);
    }
    else {
        GlStateManager.shadeModel(GL11.GL_FLAT);
    }
    buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);

    renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, partialTicks, buffer);
    buffer.setTranslation(0, 0, 0);
    tessellator.draw();

    RenderHelper.enableStandardItemLighting();
}
 
Example 2
Source File: BlockModelRendererSchematic.java    From litematica with GNU Lesser General Public License v3.0 6 votes vote down vote up
public boolean renderModel(IBlockAccess worldIn, IBakedModel modelIn, IBlockState stateIn, BlockPos posIn, BufferBuilder buffer)
{
    boolean ao = Minecraft.isAmbientOcclusionEnabled() && stateIn.getLightValue() == 0 && modelIn.isAmbientOcclusion();
    long rand = MathHelper.getPositionRandom(posIn);

    try
    {
        if (ao)
        {
            return this.renderModelSmooth(worldIn, modelIn, stateIn, posIn, buffer, rand);
        }
        else
        {
            return this.renderModelFlat(worldIn, modelIn, stateIn, posIn, buffer, rand);
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block model");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Block model being tesselated");
        CrashReportCategory.addBlockInfo(crashreportcategory, posIn, stateIn);
        crashreportcategory.addCrashSection("Using AO", Boolean.valueOf(ao));
        throw new ReportedException(crashreport);
    }
}
 
Example 3
Source File: FacadeRenderer.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static VertexLighterFlat setupLighter(CCRenderState ccrs, Matrix4 translation, IBlockState state, IBlockAccess access, BlockPos pos, IBakedModel model) {
    boolean renderAO = Minecraft.isAmbientOcclusionEnabled() && state.getLightValue(access, pos) == 0 && model.isAmbientOcclusion();
    VertexLighterFlat lighter = renderAO ? lighterSmooth.get() : lighterFlat.get();

    AdvCCRSConsumer consumer = new AdvCCRSConsumer(ccrs);
    lighter.setParent(consumer);
    consumer.setTranslation(translation);
    return lighter;
}
 
Example 4
Source File: LightMatrix.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void sideSample(int side) {
    if ((computed & 1 << side) == 0) {
        int[] ssample = ssamplem[side];
        for (int q = 0; q < 4; q++) {
            int[] qsample = qsamplem[q];
            if (Minecraft.isAmbientOcclusionEnabled()) {
                interp(side, q, ssample[qsample[0]], ssample[qsample[1]], ssample[qsample[2]], ssample[qsample[3]]);
            } else {
                interp(side, q, ssample[4], ssample[4], ssample[4], ssample[4]);
            }
        }
        computed |= 1 << side;
    }
}
 
Example 5
Source File: LightMatrix.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void sideSample(int side) {
    if ((computed & 1 << side) == 0) {
        int[] ssample = ssamplem[side];
        for (int q = 0; q < 4; q++) {
            int[] qsample = qsamplem[q];
            if (Minecraft.isAmbientOcclusionEnabled())
                interp(side, q, ssample[qsample[0]], ssample[qsample[1]], ssample[qsample[2]], ssample[qsample[3]]);
            else
                interp(side, q, ssample[4], ssample[4], ssample[4], ssample[4]);
        }
        computed |= 1 << side;
    }
}
 
Example 6
Source File: WrapperMinecraft.java    From ClientBase with MIT License 4 votes vote down vote up
public static boolean isAmbientOcclusionEnabled() {
    return Minecraft.isAmbientOcclusionEnabled();
}
 
Example 7
Source File: RenderHelper.java    From GardenCollection with MIT License 4 votes vote down vote up
public void renderFace (int face, IBlockAccess blockAccess, Block block, int x, int y, int z, IIcon icon, float r, float g, float b) {
    if (Minecraft.isAmbientOcclusionEnabled() && blockAccess != null && block.getLightValue(blockAccess, x, y, z) == 0)
        renderFaceAOPartial(face, blockAccess, block, x, y, z, icon, r, g, b);
    else
        renderFaceColorMult(face, blockAccess, block, x, y, z, icon, r, g, b);
}
 
Example 8
Source File: RenderHelper.java    From GardenCollection with MIT License 4 votes vote down vote up
public void renderPartialFace (int face, IBlockAccess blockAccess, Block block, int x, int y, int z, IIcon icon, double uMin, double vMin, double uMax, double vMax, float r, float g, float b) {
    if (Minecraft.isAmbientOcclusionEnabled() && blockAccess != null && block.getLightValue(blockAccess, x, y, z) == 0)
        renderPartialFaceAOPartial(face, blockAccess, block, x, y, z, icon, uMin, vMin, uMax, vMax, r, g, b);
    else
        renderPartialFaceColorMult(face, blockAccess, block, x, y, z, icon, uMin, vMin, uMax, vMax, r, g, b);
}