Java Code Examples for net.minecraft.block.state.IBlockState#getLightValue()

The following examples show how to use net.minecraft.block.state.IBlockState#getLightValue() . 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: 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 2
Source File: BlockEnderUtilitiesTileEntity.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
{
    if (this.isCamoBlock())
    {
        IExtendedBlockState extendedState = (IExtendedBlockState) this.getExtendedState(state.getActualState(world, pos), world, pos);
        IBlockState stateCamo = extendedState.getValue(CAMOBLOCKSTATE);

        if (stateCamo != null)
        {
            // Can't call this same world sensitive method here, because it might/will recurse back here!
            return stateCamo.getLightValue();
        }
    }

    return super.getLightValue(state, world, pos);
}
 
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: ForgeQueue_All.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getBrightness(ExtendedBlockStorage section, int x, int y, int z) {
    BlockStateContainer dataPalette = section.getData();
    IBlockState ibd = dataPalette.get(x & 15, y & 15, z & 15);
    return ibd.getLightValue();
}
 
Example 5
Source File: SpongeQueue_1_11.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getBrightness(ExtendedBlockStorage section, int x, int y, int z) {
    BlockStateContainer dataPalette = section.getData();
    IBlockState ibd = dataPalette.get(x & 15, y & 15, z & 15);
    return ibd.getLightValue();
}
 
Example 6
Source File: SpongeQueue_1_12.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getBrightness(ExtendedBlockStorage section, int x, int y, int z) {
    BlockStateContainer dataPalette = section.getData();
    IBlockState ibd = dataPalette.get(x & 15, y & 15, z & 15);
    return ibd.getLightValue();
}
 
Example 7
Source File: ForgeQueue_All.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getBrightness(ExtendedBlockStorage section, int x, int y, int z) {
    BlockStateContainer dataPalette = section.getData();
    IBlockState ibd = dataPalette.get(x & 15, y & 15, z & 15);
    return ibd.getLightValue();
}
 
Example 8
Source File: ForgeQueue_All.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getBrightness(ExtendedBlockStorage section, int x, int y, int z) {
    BlockStateContainer dataPalette = section.getData();
    IBlockState ibd = dataPalette.get(x & 15, y & 15, z & 15);
    return ibd.getLightValue();
}
 
Example 9
Source File: ForgeQueue_All.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getBrightness(ExtendedBlockStorage section, int x, int y, int z) {
    BlockStateContainer dataPalette = section.getData();
    IBlockState ibd = dataPalette.get(x & 15, y & 15, z & 15);
    return ibd.getLightValue();
}