当前位置: 首页>>代码示例>>Java>>正文


Java Chunk.isPopulated方法代码示例

本文整理汇总了Java中net.minecraft.world.chunk.Chunk.isPopulated方法的典型用法代码示例。如果您正苦于以下问题:Java Chunk.isPopulated方法的具体用法?Java Chunk.isPopulated怎么用?Java Chunk.isPopulated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.world.chunk.Chunk的用法示例。


在下文中一共展示了Chunk.isPopulated方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: markAndNotifyBlock

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
public void markAndNotifyBlock(BlockPos pos, Chunk chunk, IBlockState iblockstate, IBlockState newState, int flags)
{
    {
        {
            if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && (chunk == null || chunk.isPopulated()))
            {
                this.notifyBlockUpdate(pos, iblockstate, newState, flags);
            }

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

                if (newState.hasComparatorInputOverride())
                {
                    this.updateComparatorOutputLevel(pos, newState.getBlock());
                }
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:22,代码来源:World.java

示例2: removePlayer

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
public void removePlayer(EntityPlayerMP player)
{
    if (this.playersWatchingChunk.contains(player))
    {
        Chunk chunk = PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos);

        if (chunk.isPopulated())
        {
            player.playerNetServerHandler.sendPacket(new S21PacketChunkData(chunk, true, 0));
        }

        this.playersWatchingChunk.remove(player);
        player.loadedChunks.remove(this.chunkCoords);

        if (this.playersWatchingChunk.isEmpty())
        {
            long i = (long)this.chunkCoords.chunkXPos + 2147483647L | (long)this.chunkCoords.chunkZPos + 2147483647L << 32;
            this.increaseInhabitedTime(chunk);
            PlayerManager.this.playerInstances.remove(i);
            PlayerManager.this.playerInstanceList.remove(this);

            if (this.numBlocksToUpdate > 0)
            {
                PlayerManager.this.playerInstancesToUpdate.remove(this);
            }

            PlayerManager.this.getWorldServer().theChunkProviderServer.dropChunk(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:31,代码来源:PlayerManager.java

示例3: setBlockState

import net.minecraft.world.chunk.Chunk; //导入方法依赖的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

示例4: setBlockState

import net.minecraft.world.chunk.Chunk; //导入方法依赖的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


注:本文中的net.minecraft.world.chunk.Chunk.isPopulated方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。