當前位置: 首頁>>代碼示例>>Java>>正文


Java IBlockState.getLightValue方法代碼示例

本文整理匯總了Java中net.minecraft.block.state.IBlockState.getLightValue方法的典型用法代碼示例。如果您正苦於以下問題:Java IBlockState.getLightValue方法的具體用法?Java IBlockState.getLightValue怎麽用?Java IBlockState.getLightValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.block.state.IBlockState的用法示例。


在下文中一共展示了IBlockState.getLightValue方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: renderModel

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
public boolean renderModel(IBlockAccess worldIn, IBakedModel modelIn, IBlockState stateIn, BlockPos posIn, VertexBuffer buffer, boolean checkSides, long rand)
{
    boolean flag = Minecraft.isAmbientOcclusionEnabled() && stateIn.getLightValue() == 0 && modelIn.isAmbientOcclusion();

    try
    {
        return flag ? this.renderModelSmooth(worldIn, modelIn, stateIn, posIn, buffer, checkSides, rand) : this.renderModelFlat(worldIn, modelIn, stateIn, posIn, buffer, checkSides, 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(flag));
        throw new ReportedException(crashreport);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:18,代碼來源:BlockModelRenderer.java

示例2: getLightValue

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
/**
 * Get a light value for the block at the specified coordinates, normal ranges are between 0 and 15
 *
 * @param state Block state
 * @param world The current world
 * @param pos Block position in world
 * @return The light value
 */
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
{
    IBlockState other = world.getBlockState(pos);
    if (other.getBlock() != this)
    {
        return other.getLightValue(world, pos);
    }
    return state.getLightValue();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:18,代碼來源:Block.java

示例3: setBlockState

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
/**
 * Sets the block state at a given location. Flag 1 will cause a block update. Flag 2 will send the change to
 * clients (you almost always want this). Flag 4 prevents the block from being re-rendered, if this is a client
 * world. Flags can be added together.
 */
public boolean setBlockState(BlockPos pos, IBlockState newState, int flags)
{
    if (this.isOutsideBuildHeight(pos))
    {
        return false;
    }
    else if (!this.isRemote && this.worldInfo.getTerrainType() == WorldType.DEBUG_WORLD)
    {
        return false;
    }
    else
    {
        Chunk chunk = this.getChunkFromBlockCoords(pos);
        Block block = newState.getBlock();
        IBlockState iblockstate = chunk.setBlockState(pos, newState);

        if (iblockstate == null)
        {
            return false;
        }
        else
        {
            if (newState.getLightOpacity() != iblockstate.getLightOpacity() || newState.getLightValue() != iblockstate.getLightValue())
            {
                this.theProfiler.startSection("checkLight");
                this.checkLight(pos);
                this.theProfiler.endSection();
            }

            if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && chunk.isPopulated())
            {
                this.notifyBlockUpdate(pos, iblockstate, newState, flags);
            }

            if (!this.isRemote && (flags & 1) != 0)
            {
                this.notifyNeighborsRespectDebug(pos, iblockstate.getBlock(), true);

                if (newState.hasComparatorInputOverride())
                {
                    this.updateComparatorOutputLevel(pos, block);
                }
            }
            else if (!this.isRemote && (flags & 16) == 0)
            {
                this.func_190522_c(pos, block);
            }

            return true;
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:58,代碼來源:World.java

示例4: getRawLight

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
/**
 * gets the light level at the supplied position
 */
private int getRawLight(BlockPos pos, EnumSkyBlock lightType)
{
    if (lightType == EnumSkyBlock.SKY && this.canSeeSky(pos))
    {
        return 15;
    }
    else
    {
        IBlockState iblockstate = this.getBlockState(pos);
        int i = lightType == EnumSkyBlock.SKY ? 0 : iblockstate.getLightValue();
        int j = iblockstate.getLightOpacity();

        if (j >= 15 && iblockstate.getLightValue() > 0)
        {
            j = 1;
        }

        if (j < 1)
        {
            j = 1;
        }

        if (j >= 15)
        {
            return 0;
        }
        else if (i >= 14)
        {
            return i;
        }
        else
        {
            BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();

            for (EnumFacing enumfacing : EnumFacing.values())
            {
                blockpos$pooledmutableblockpos.setPos(pos).move(enumfacing);
                int k = this.getLightFor(lightType, blockpos$pooledmutableblockpos) - j;

                if (k > i)
                {
                    i = k;
                }

                if (i >= 14)
                {
                    return i;
                }
            }

            blockpos$pooledmutableblockpos.release();
            return i;
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:59,代碼來源:World.java

示例5: renderModel

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
public boolean renderModel(IBlockAccess worldIn, IBakedModel modelIn, IBlockState stateIn, BlockPos posIn, VertexBuffer buffer, boolean checkSides, long rand)
{
    boolean flag = Minecraft.isAmbientOcclusionEnabled() && stateIn.getLightValue() == 0 && modelIn.isAmbientOcclusion();

    try
    {
        if (Config.isShaders())
        {
            SVertexBuilder.pushEntity(stateIn, posIn, worldIn, buffer);
        }

        if (!Config.isAlternateBlocks())
        {
            rand = 0L;
        }

        RenderEnv renderenv = buffer.getRenderEnv(worldIn, stateIn, posIn);
        modelIn = BlockModelCustomizer.getRenderModel(modelIn, stateIn, renderenv);
        boolean flag1 = flag ? this.renderModelSmooth(worldIn, modelIn, stateIn, posIn, buffer, checkSides, rand) : this.renderModelFlat(worldIn, modelIn, stateIn, posIn, buffer, checkSides, rand);

        if (flag1)
        {
            this.renderOverlayModels(worldIn, modelIn, stateIn, posIn, buffer, checkSides, rand, renderenv, flag);
        }

        if (Config.isShaders())
        {
            SVertexBuilder.popEntity(buffer);
        }

        return flag1;
    }
    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(flag));
        throw new ReportedException(crashreport);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:42,代碼來源:BlockModelRenderer.java

示例6: setBlockState

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
/**
 * Sets the block state at a given location. Flag 1 will cause a block update. Flag 2 will send the change to
 * clients (you almost always want this). Flag 4 prevents the block from being re-rendered, if this is a client
 * world. Flags can be added together.
 */
public boolean setBlockState(BlockPos pos, IBlockState newState, int flags)
{
    if (this.isOutsideBuildHeight(pos))
    {
        return false;
    }
    else if (!this.isRemote && this.worldInfo.getTerrainType() == WorldType.DEBUG_WORLD)
    {
        return false;
    }
    else
    {
        Chunk chunk = this.getChunkFromBlockCoords(pos);
        Block block = newState.getBlock();

        net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null;
        if (this.captureBlockSnapshots && !this.isRemote)
        {
            blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, pos, flags);
            this.capturedBlockSnapshots.add(blockSnapshot);
        }
        IBlockState oldState = getBlockState(pos);
        int oldLight = oldState.getLightValue(this, pos);
        int oldOpacity = oldState.getLightOpacity(this, pos);

        IBlockState iblockstate = chunk.setBlockState(pos, newState);

        if (iblockstate == null)
        {
            if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot);
            return false;
        }
        else
        {
            if (newState.getLightOpacity(this, pos) != oldOpacity || newState.getLightValue(this, pos) != oldLight)
            {
                this.theProfiler.startSection("checkLight");
                this.checkLight(pos);
                this.theProfiler.endSection();
            }

            if (blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates
            {
                this.markAndNotifyBlock(pos, chunk, iblockstate, newState, flags);
            }
            return true;
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:55,代碼來源:World.java


注:本文中的net.minecraft.block.state.IBlockState.getLightValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。