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


Java Block.hasComparatorInputOverride方法代碼示例

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


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

示例1: setBlockState

import net.minecraft.block.Block; //導入方法依賴的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.isValid(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
        {
            Block block1 = iblockstate.getBlock();

            if (block.getLightOpacity() != block1.getLightOpacity() || block.getLightValue() != block1.getLightValue())
            {
                this.theProfiler.startSection("checkLight");
                this.checkLight(pos);
                this.theProfiler.endSection();
            }

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

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

                if (block.hasComparatorInputOverride())
                {
                    this.updateComparatorOutputLevel(pos, block);
                }
            }

            return true;
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:56,代碼來源:World.java


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