本文整理汇总了C++中BlockIterator::moveBy方法的典型用法代码示例。如果您正苦于以下问题:C++ BlockIterator::moveBy方法的具体用法?C++ BlockIterator::moveBy怎么用?C++ BlockIterator::moveBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlockIterator
的用法示例。
在下文中一共展示了BlockIterator::moveBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: randomTick
void Dirt::randomTick(const Block &block, World &world, BlockIterator blockIterator, WorldLockManager &lock_manager) const
{
BlockIterator bi = blockIterator;
bi.moveBy(VectorI(0, 1, 0));
Block b = bi.get(lock_manager);
if(!b.good())
return;
if(b.lighting.toFloat(world.getLighting(bi.position().d)) < 4.0f / 15 || !b.descriptor->lightProperties.isTotallyTransparent())
return;
for(int dx = -1; dx <= 1; dx++)
{
for(int dy = -3; dy <= 1; dy++)
{
for(int dz = -1; dz <= 1; dz++)
{
bi = blockIterator;
bi.moveBy(VectorI(dx, dy, dz));
b = bi.get(lock_manager);
if(b.descriptor != Grass::descriptor())
continue;
bi.moveBy(VectorI(0, 1, 0));
Block b = bi.get(lock_manager);
if(b.lighting.toFloat(world.getLighting(bi.position().d)) < 9.0f / 15)
continue;
world.setBlock(blockIterator, lock_manager, Block(Grass::descriptor()));
return;
}
}
}
}
示例2: randomTick
void Grass::randomTick(const Block &block, World &world, BlockIterator blockIterator, WorldLockManager &lock_manager) const
{
BlockIterator bi = blockIterator;
bi.moveBy(VectorI(0, 1, 0));
Block b = bi.get(lock_manager);
if((b.lighting.toFloat(world.getLighting(bi.position().d)) >= 4.0f / 15 || b.lighting.indirectSkylight >= 4) && b.descriptor->lightProperties.isTotallyTransparent())
return;
world.setBlock(blockIterator, lock_manager, Block(Dirt::descriptor()));
}