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


Java Chunk.getTopFilledSegment方法代码示例

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


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

示例1: getTopBlock

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
public static BlockPos getTopBlock(World world, BlockPos pos)
{
	Chunk chunk = world.getChunkFromBlockCoords(pos);
       BlockPos blockpos;
       BlockPos blockpos1;

       for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1)
       {
           blockpos1 = blockpos.down();
           IBlockState state = chunk.getBlockState(blockpos1);
           if ((state.getMaterial().blocksMovement() && !state.getBlock().isLeaves(state, world, blockpos1) && !state.getBlock().isFoliage(world, blockpos1) && state.getBlock() != Blocks.LOG
           		&& state.getBlock() != Blocks.LOG2) || state.getBlock() instanceof BlockLiquid)
           	break;
       }
       return blockpos;		
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:17,代码来源:HarshenUtils.java

示例2: getTopSolidOrLiquidBlock

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Finds the highest block on the x and z coordinate that is solid or liquid, and returns its y coord.
 */
public BlockPos getTopSolidOrLiquidBlock(BlockPos pos)
{
    Chunk chunk = this.getChunkFromBlockCoords(pos);
    BlockPos blockpos;
    BlockPos blockpos1;

    for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1)
    {
        blockpos1 = blockpos.down();
        Material material = chunk.getBlock(blockpos1).getMaterial();

        if (material.blocksMovement() && material != Material.leaves)
        {
            break;
        }
    }

    return blockpos;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:23,代码来源:World.java

示例3: getTopSolidOrLiquidBlock

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Finds the highest block on the x and z coordinate that is solid or liquid, and returns its y coord.
 */
public BlockPos getTopSolidOrLiquidBlock(BlockPos pos)
{
    Chunk chunk = this.getChunkFromBlockCoords(pos);
    BlockPos blockpos;
    BlockPos blockpos1;

    for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1)
    {
        blockpos1 = blockpos.down();
        Material material = chunk.getBlockState(blockpos1).getMaterial();

        if (material.blocksMovement() && material != Material.LEAVES)
        {
            break;
        }
    }

    return blockpos;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:23,代码来源:World.java

示例4: getTopSolidOrLiquidBlock

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Finds the highest block on the x and z coordinate that is solid or liquid, and returns its y coord.
 */
public BlockPos getTopSolidOrLiquidBlock(BlockPos pos)
{
    Chunk chunk = this.getChunkFromBlockCoords(pos);
    BlockPos blockpos;
    BlockPos blockpos1;

    for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1)
    {
        blockpos1 = blockpos.down();
        IBlockState state = chunk.getBlockState(blockpos1);

        if (state.getMaterial().blocksMovement() && !state.getBlock().isLeaves(state, this, blockpos1) && !state.getBlock().isFoliage(this, blockpos1))
        {
            break;
        }
    }

    return blockpos;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:23,代码来源:World.java

示例5: generateHeightMap

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Recalculate height map and precipitations map for chunk
 * @param chunk Chunk to process
 */
public void generateHeightMap(Chunk chunk) {
    int i = chunk.getTopFilledSegment();
    int heightMapMinimum = Integer.MAX_VALUE;
    int[] heightMap = new int[256];
    for (int j = 0; j < 16; ++j) {
        for (int k = 0; k < 16; ++k) {
            for (int l = i + 16; l > 0; --l) {
                UBlockState state = new UBlockState(chunk.getBlockState(j, l - 1, k));
                if (state.getOpacity() != 0) {
                    heightMap[k << 4 | j] = l;
                    if (l < heightMapMinimum) {
                        heightMapMinimum = l;
                    }
                    break;
                }
            }
        }
    }
    chunk.setHeightMap(heightMap);
}
 
开发者ID:ternsip,项目名称:StructPro,代码行数:25,代码来源:UWorld.java

示例6: generateHeightMap

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Recalculate height map and precipitations map for chunk
 * @param chunk Chunk to process
 */
public void generateHeightMap(Chunk chunk) {
    int i = chunk.getTopFilledSegment();
    chunk.heightMapMinimum = Integer.MAX_VALUE;
    for (int j = 0; j < 16; ++j) {
        int k = 0;
        while (k < 16) {
            int l = i + 16 - 1;
            while (true) {
                if (l > 0) {
                    if (chunk.func_150808_b(j, l - 1, k) == 0) {
                        --l;
                        continue;
                    }
                    chunk.heightMap[k << 4 | j] = l;
                    if (l < chunk.heightMapMinimum) {
                        chunk.heightMapMinimum = l;
                    }
                }
                ++k;
                break;
            }
        }
    }
}
 
开发者ID:ternsip,项目名称:StructPro,代码行数:29,代码来源:UWorld.java

示例7: findSpawnpointInChunk

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
@Nullable
private static BlockPos findSpawnpointInChunk(Chunk chunkIn)
{
    BlockPos blockpos = new BlockPos(chunkIn.xPosition * 16, 30, chunkIn.zPosition * 16);
    int i = chunkIn.getTopFilledSegment() + 16 - 1;
    BlockPos blockpos1 = new BlockPos(chunkIn.xPosition * 16 + 16 - 1, i, chunkIn.zPosition * 16 + 16 - 1);
    BlockPos blockpos2 = null;
    double d0 = 0.0D;

    for (BlockPos blockpos3 : BlockPos.getAllInBox(blockpos, blockpos1))
    {
        IBlockState iblockstate = chunkIn.getBlockState(blockpos3);

        if (iblockstate.getBlock() == Blocks.END_STONE && !chunkIn.getBlockState(blockpos3.up(1)).isBlockNormalCube() && !chunkIn.getBlockState(blockpos3.up(2)).isBlockNormalCube())
        {
            double d1 = blockpos3.distanceSqToCenter(0.0D, 0.0D, 0.0D);

            if (blockpos2 == null || d1 < d0)
            {
                blockpos2 = blockpos3;
                d0 = d1;
            }
        }
    }

    return blockpos2;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:28,代码来源:TileEntityEndGateway.java


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