本文整理汇总了Java中cn.nukkit.level.format.generic.BaseFullChunk.getFullBlock方法的典型用法代码示例。如果您正苦于以下问题:Java BaseFullChunk.getFullBlock方法的具体用法?Java BaseFullChunk.getFullBlock怎么用?Java BaseFullChunk.getFullBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.level.format.generic.BaseFullChunk
的用法示例。
在下文中一共展示了BaseFullChunk.getFullBlock方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBlock
import cn.nukkit.level.format.generic.BaseFullChunk; //导入方法依赖的package包/类
public Block getBlock(Vector3 pos, boolean cached) {
long chunkIndex = Level.chunkHash((int) pos.x >> 4, (int) pos.z >> 4);
BlockVector3 index = Level.blockHash((int) pos.x, (int) pos.y, (int) pos.z);
int fullState;
Block block;
BaseFullChunk chunk;
if (cached && (block = (Block) this.blockCache.get(index)) != null) {
return block;
} else if (pos.y >= 0 && pos.y < 256 && (chunk = this.chunks.get(chunkIndex)) != null) {
fullState = chunk.getFullBlock((int) pos.x & 0x0f, (int) pos.y & 0xff,
(int) pos.z & 0x0f);
} else {
fullState = 0;
}
block = this.blockStates[fullState & 0xfff].clone();
block.x = pos.x;
block.y = pos.y;
block.z = pos.z;
block.level = this;
this.blockCache.put(index, block);
return block;
}