本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
}
}
}
示例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;
}