本文整理汇总了Java中cn.nukkit.math.AxisAlignedBB.intersectsWith方法的典型用法代码示例。如果您正苦于以下问题:Java AxisAlignedBB.intersectsWith方法的具体用法?Java AxisAlignedBB.intersectsWith怎么用?Java AxisAlignedBB.intersectsWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.math.AxisAlignedBB
的用法示例。
在下文中一共展示了AxisAlignedBB.intersectsWith方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isInsideOfSolid
import cn.nukkit.math.AxisAlignedBB; //导入方法依赖的package包/类
public boolean isInsideOfSolid() {
double y = this.y + this.getEyeHeight();
Block block = this.level.getBlock(
this.temporalVector.setComponents(
NukkitMath.floorDouble(this.x),
NukkitMath.floorDouble(y),
NukkitMath.floorDouble(this.z))
);
AxisAlignedBB bb = block.getBoundingBox();
return bb != null && block.isSolid() && !block.isTransparent() && bb.intersectsWith(this.getBoundingBox());
}
示例2: collidesWithBB
import cn.nukkit.math.AxisAlignedBB; //导入方法依赖的package包/类
@Override
public boolean collidesWithBB(AxisAlignedBB bb) {
int damage = this.getDamage();
int side = damage & 0x03;
double f = 0;
double f1 = 0.5;
double f2 = 0.5;
double f3 = 1;
if ((damage & 0x04) > 0) {
f = 0.5;
f1 = 1;
f2 = 0;
f3 = 0.5;
}
if (bb.intersectsWith(new AxisAlignedBB(
this.x,
this.y + f,
this.z,
this.x + 1,
this.y + f1,
this.z + 1
))) {
return true;
}
if (side == 0) {
if (bb.intersectsWith(new AxisAlignedBB(
this.x + 0.5,
this.y + f2,
this.z,
this.x + 1,
this.y + f3,
this.z + 1
))) {
return true;
}
} else if (side == 1) {
if (bb.intersectsWith(new AxisAlignedBB(
this.x,
this.y + f2,
this.z,
this.x + 0.5,
this.y + f3,
this.z + 1
))) {
return true;
}
} else if (side == 2) {
if (bb.intersectsWith(new AxisAlignedBB(
this.x,
this.y + f2,
this.z + 0.5,
this.x + 1,
this.y + f3,
this.z + 1
))) {
return true;
}
} else if (side == 3) {
if (bb.intersectsWith(new AxisAlignedBB(
this.x,
this.y + f2,
this.z,
this.x + 1,
this.y + f3,
this.z + 0.5
))) {
return true;
}
}
return false;
}
示例3: collidesWithBB
import cn.nukkit.math.AxisAlignedBB; //导入方法依赖的package包/类
public boolean collidesWithBB(AxisAlignedBB bb, boolean collisionBB) {
AxisAlignedBB bb1 = collisionBB ? this.getCollisionBoundingBox() : this.getBoundingBox();
return bb1 != null && bb.intersectsWith(bb1);
}