本文整理汇总了Java中cn.nukkit.math.Vector3.add方法的典型用法代码示例。如果您正苦于以下问题:Java Vector3.add方法的具体用法?Java Vector3.add怎么用?Java Vector3.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.math.Vector3
的用法示例。
在下文中一共展示了Vector3.add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: growLeavesLayerStrict
import cn.nukkit.math.Vector3; //导入方法依赖的package包/类
/**
* grow leaves in a circle with the outsides being within the circle
*/
protected void growLeavesLayerStrict(ChunkManager worldIn, Vector3 layerCenter, int width) {
int i = width * width;
for (int j = -width; j <= width + 1; ++j) {
for (int k = -width; k <= width + 1; ++k) {
int l = j - 1;
int i1 = k - 1;
if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i) {
Vector3 blockpos = layerCenter.add(j, 0, k);
int id = worldIn.getBlockIdAt((int) blockpos.x, (int) blockpos.y, (int) blockpos.z);
if (id == Block.AIR || id == Block.LEAVES) {
this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata);
}
}
}
}
}
示例2: growLeavesLayer
import cn.nukkit.math.Vector3; //导入方法依赖的package包/类
/**
* grow leaves in a circle
*/
protected void growLeavesLayer(ChunkManager worldIn, Vector3 layerCenter, int width) {
int i = width * width;
for (int j = -width; j <= width; ++j) {
for (int k = -width; k <= width; ++k) {
if (j * j + k * k <= i) {
Vector3 blockpos = layerCenter.add(j, 0, k);
int id = worldIn.getBlockIdAt((int) blockpos.x, (int) blockpos.y, (int) blockpos.z);
if (id == Block.AIR || id == Block.LEAVES) {
this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata);
}
}
}
}
}
示例3: isSpaceAt
import cn.nukkit.math.Vector3; //导入方法依赖的package包/类
/**
* returns whether or not there is space for a tree to grow at a certain position
*/
private boolean isSpaceAt(ChunkManager worldIn, Vector3 leavesPos, int height) {
boolean flag = true;
if (leavesPos.getY() >= 1 && leavesPos.getY() + height + 1 <= 256) {
for (int i = 0; i <= 1 + height; ++i) {
int j = 2;
if (i == 0) {
j = 1;
} else if (i >= 1 + height - 2) {
j = 2;
}
for (int k = -j; k <= j && flag; ++k) {
for (int l = -j; l <= j && flag; ++l) {
Vector3 blockPos = leavesPos.add(k, i, l);
if (leavesPos.getY() + i < 0 || leavesPos.getY() + i >= 256 || !this.canGrowInto(worldIn.getBlockIdAt((int) blockPos.x, (int) blockPos.y, (int) blockPos.z))) {
flag = false;
}
}
}
}
return flag;
} else {
return false;
}
}