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


Java Chunk.isEmpty方法代码示例

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


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

示例1: isBlockNormalCube

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Checks if a block's material is opaque, and that it takes up a full cube
 */
public boolean isBlockNormalCube(BlockPos pos, boolean _default)
{
    if (!this.isValid(pos))
    {
        return _default;
    }
    else
    {
        Chunk chunk = this.chunkProvider.provideChunk(pos);

        if (chunk.isEmpty())
        {
            return _default;
        }
        else
        {
            Block block = this.getBlockState(pos).getBlock();
            return block.getMaterial().isOpaque() && block.isFullCube();
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:25,代码来源:World.java

示例2: isBlockNormalCube

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Checks if a block's material is opaque, and that it takes up a full cube
 */
public boolean isBlockNormalCube(BlockPos pos, boolean _default)
{
    if (this.isOutsideBuildHeight(pos))
    {
        return false;
    }
    else
    {
        Chunk chunk = this.chunkProvider.getLoadedChunk(pos.getX() >> 4, pos.getZ() >> 4);

        if (chunk != null && !chunk.isEmpty())
        {
            IBlockState iblockstate = this.getBlockState(pos);
            return iblockstate.getMaterial().isOpaque() && iblockstate.isFullCube();
        }
        else
        {
            return _default;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:World.java

示例3: isBlockNormalCube

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Checks if a block's material is opaque, and that it takes up a full cube
 */
public boolean isBlockNormalCube(BlockPos pos, boolean _default)
{
    if (this.isOutsideBuildHeight(pos))
    {
        return false;
    }
    else
    {
        Chunk chunk = this.chunkProvider.getLoadedChunk(pos.getX() >> 4, pos.getZ() >> 4);

        if (chunk != null && !chunk.isEmpty())
        {
            IBlockState iblockstate = this.getBlockState(pos);
            return iblockstate.getBlock().isNormalCube(iblockstate, this, pos);
        }
        else
        {
            return _default;
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:World.java

示例4: unloadChunk

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Unload chunk from ChunkProviderClient's hashmap. Called in response to a Packet50PreChunk with its mode field set
 * to false
 */
public void unloadChunk(int p_73234_1_, int p_73234_2_)
{
    Chunk chunk = this.provideChunk(p_73234_1_, p_73234_2_);

    if (!chunk.isEmpty())
    {
        chunk.onChunkUnload();
    }

    this.chunkMapping.remove(ChunkCoordIntPair.chunkXZ2Int(p_73234_1_, p_73234_2_));
    this.chunkListing.remove(chunk);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:17,代码来源:ChunkProviderClient.java

示例5: isChunkReady

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
private boolean isChunkReady()
{
    // First, find the starting position we ought to have:
    List<AgentSection> agents = currentMissionInit().getMission().getAgentSection();
    if (agents == null || agents.size() <= currentMissionInit().getClientRole())
        return true;    // This should never happen.
    AgentSection as = agents.get(currentMissionInit().getClientRole());
    if (as.getAgentStart() != null && as.getAgentStart().getPlacement() != null)
    {
        PosAndDirection pos = as.getAgentStart().getPlacement();
        int x = MathHelper.floor_double(pos.getX().doubleValue()) >> 4;
        int z = MathHelper.floor_double(pos.getZ().doubleValue()) >> 4;
        // Now get the chunk we should be starting in:
        IChunkProvider chunkprov = Minecraft.getMinecraft().theWorld.getChunkProvider();
        EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
        if (player.addedToChunk)
        {
            // Our player is already added to a chunk - is it the right one?
            Chunk actualChunk = chunkprov.provideChunk(player.chunkCoordX, player.chunkCoordZ);
            Chunk requestedChunk = chunkprov.provideChunk(x,  z);
            if (actualChunk == requestedChunk && actualChunk != null && !actualChunk.isEmpty())
            {
                // We're in the right chunk, and it's not an empty chunk.
                // We're ready to proceed, but first set our client positions to where we ought to be.
                // The server should be doing this too, but there's no harm (probably) in doing it ourselves.
                player.posX = pos.getX().doubleValue();
                player.posY = pos.getY().doubleValue();
                player.posZ = pos.getZ().doubleValue();
                return true;
            }
        }
        return false;   // Our starting position has been specified, but it's not yet ready.
    }
    return true;    // No starting position specified, so doesn't matter where we start.
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:36,代码来源:ClientStateMachine.java

示例6: unloadChunk

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Unload chunk from ChunkProviderClient's hashmap. Called in response to a Packet50PreChunk with its mode field set
 * to false
 */
public void unloadChunk(int x, int z)
{
    Chunk chunk = this.provideChunk(x, z);

    if (!chunk.isEmpty())
    {
        chunk.onChunkUnload();
    }

    this.chunkMapping.remove(ChunkPos.asLong(x, z));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:16,代码来源:ChunkProviderClient.java

示例7: isSideSolid

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Determine if the given block is considered solid on the
 * specified side.  Used by placement logic.
 *
 * @param pos Block Position
 * @param side The Side in question
 * @param _default The default to return if the block doesn't exist.
 * @return True if the side is solid
 */
@Override
public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default)
{
    if (!this.isValid(pos)) return _default;

    Chunk chunk = getChunkFromBlockCoords(pos);
    if (chunk == null || chunk.isEmpty()) return _default;
    return getBlockState(pos).isSideSolid(this, pos, side);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:19,代码来源:World.java

示例8: call

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
@SuppressWarnings("incomplete-switch")
protected List<String> call()
{
    BlockPos blockpos = new BlockPos(this.mc.getRenderViewEntity().posX, this.mc.getRenderViewEntity().getEntityBoundingBox().minY, this.mc.getRenderViewEntity().posZ);

    if (this.mc.isReducedDebug())
    {
        return Lists.newArrayList(new String[] {"Minecraft 1.10.2 (" + this.mc.getVersion() + "/" + ClientBrandRetriever.getClientModName() + ")", this.mc.debug, this.mc.renderGlobal.getDebugInfoRenders(), this.mc.renderGlobal.getDebugInfoEntities(), "P: " + this.mc.effectRenderer.getStatistics() + ". T: " + this.mc.theWorld.getDebugLoadedEntities(), this.mc.theWorld.getProviderName(), "", String.format("Chunk-relative: %d %d %d", new Object[]{Integer.valueOf(blockpos.getX() & 15), Integer.valueOf(blockpos.getY() & 15), Integer.valueOf(blockpos.getZ() & 15)})});
    }
    else
    {
        Entity entity = this.mc.getRenderViewEntity();
        EnumFacing enumfacing = entity.getHorizontalFacing();
        String s = "Invalid";

        switch (enumfacing)
        {
            case NORTH:
                s = "Towards negative Z";
                break;
            case SOUTH:
                s = "Towards positive Z";
                break;
            case WEST:
                s = "Towards negative X";
                break;
            case EAST:
                s = "Towards positive X";
        }

        List<String> list = Lists.newArrayList(new String[] {"Minecraft 1.10.2 (" + this.mc.getVersion() + "/" + ClientBrandRetriever.getClientModName() + ("release".equalsIgnoreCase(this.mc.getVersionType()) ? "" : "/" + this.mc.getVersionType()) + ")", this.mc.debug, this.mc.renderGlobal.getDebugInfoRenders(), this.mc.renderGlobal.getDebugInfoEntities(), "P: " + this.mc.effectRenderer.getStatistics() + ". T: " + this.mc.theWorld.getDebugLoadedEntities(), this.mc.theWorld.getProviderName(), "", String.format("XYZ: %.3f / %.5f / %.3f", new Object[]{Double.valueOf(this.mc.getRenderViewEntity().posX), Double.valueOf(this.mc.getRenderViewEntity().getEntityBoundingBox().minY), Double.valueOf(this.mc.getRenderViewEntity().posZ)}), String.format("Block: %d %d %d", new Object[]{Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())}), String.format("Chunk: %d %d %d in %d %d %d", new Object[]{Integer.valueOf(blockpos.getX() & 15), Integer.valueOf(blockpos.getY() & 15), Integer.valueOf(blockpos.getZ() & 15), Integer.valueOf(blockpos.getX() >> 4), Integer.valueOf(blockpos.getY() >> 4), Integer.valueOf(blockpos.getZ() >> 4)}), String.format("Facing: %s (%s) (%.1f / %.1f)", new Object[]{enumfacing, s, Float.valueOf(MathHelper.wrapDegrees(entity.rotationYaw)), Float.valueOf(MathHelper.wrapDegrees(entity.rotationPitch))})});

        if (this.mc.theWorld != null)
        {
            Chunk chunk = this.mc.theWorld.getChunkFromBlockCoords(blockpos);

            if (this.mc.theWorld.isBlockLoaded(blockpos) && blockpos.getY() >= 0 && blockpos.getY() < 256)
            {
                if (!chunk.isEmpty())
                {
                    list.add("Biome: " + chunk.getBiome(blockpos, this.mc.theWorld.getBiomeProvider()).getBiomeName());
                    list.add("Light: " + chunk.getLightSubtracted(blockpos, 0) + " (" + chunk.getLightFor(EnumSkyBlock.SKY, blockpos) + " sky, " + chunk.getLightFor(EnumSkyBlock.BLOCK, blockpos) + " block)");
                    DifficultyInstance difficultyinstance = this.mc.theWorld.getDifficultyForLocation(blockpos);

                    if (this.mc.isIntegratedServerRunning() && this.mc.getIntegratedServer() != null)
                    {
                        EntityPlayerMP entityplayermp = this.mc.getIntegratedServer().getPlayerList().getPlayerByUUID(this.mc.thePlayer.getUniqueID());

                        if (entityplayermp != null)
                        {
                            difficultyinstance = entityplayermp.worldObj.getDifficultyForLocation(new BlockPos(entityplayermp));
                        }
                    }

                    list.add(String.format("Local Difficulty: %.2f // %.2f (Day %d)", new Object[] {Float.valueOf(difficultyinstance.getAdditionalDifficulty()), Float.valueOf(difficultyinstance.getClampedAdditionalDifficulty()), Long.valueOf(this.mc.theWorld.getWorldTime() / 24000L)}));
                }
                else
                {
                    list.add("Waiting for chunk...");
                }
            }
            else
            {
                list.add("Outside of world...");
            }
        }

        if (this.mc.entityRenderer != null && this.mc.entityRenderer.isShaderActive())
        {
            list.add("Shader: " + this.mc.entityRenderer.getShaderGroup().getShaderGroupName());
        }

        if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK && this.mc.objectMouseOver.getBlockPos() != null)
        {
            BlockPos blockpos1 = this.mc.objectMouseOver.getBlockPos();
            list.add(String.format("Looking at: %d %d %d", new Object[] {Integer.valueOf(blockpos1.getX()), Integer.valueOf(blockpos1.getY()), Integer.valueOf(blockpos1.getZ())}));
        }

        return list;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:82,代码来源:GuiOverlayDebug.java


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