本文整理汇总了Java中cn.nukkit.block.Block.onEntityCollide方法的典型用法代码示例。如果您正苦于以下问题:Java Block.onEntityCollide方法的具体用法?Java Block.onEntityCollide怎么用?Java Block.onEntityCollide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.block.Block
的用法示例。
在下文中一共展示了Block.onEntityCollide方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkBlockCollision
import cn.nukkit.block.Block; //导入方法依赖的package包/类
@Override
protected void checkBlockCollision() {
boolean portal = false;
Block block = this.getLevelBlock();
if (block.getId() == Block.NETHER_PORTAL) {
portal = true;
}
block.onEntityCollide(this);
if (portal) {
inPortalTicks++;
}
}
示例2: checkBlockCollision
import cn.nukkit.block.Block; //导入方法依赖的package包/类
protected void checkBlockCollision() {
Vector3 vector = new Vector3(0, 0, 0);
boolean portal = false;
for (Block block : this.getCollisionBlocks()) {
if (block.getId() == Block.NETHER_PORTAL) {
portal = true;
continue;
}
block.onEntityCollide(this);
block.addVelocityToEntity(this, vector);
}
if (portal) {
inPortalTicks++;
}
if (vector.lengthSquared() > 0) {
vector = vector.normalize();
double d = 0.014d;
this.motionX += vector.x * d;
this.motionY += vector.y * d;
this.motionZ += vector.z * d;
}
}
示例3: checkBlockCollision
import cn.nukkit.block.Block; //导入方法依赖的package包/类
protected void checkBlockCollision() {
Vector3 vector = new Vector3(0, 0, 0);
boolean portal = false;
for (Block block : this.getCollisionBlocks()) {
if (block.getId() == Block.NETHER_PORTAL) {
portal = true;
continue;
}
block.onEntityCollide(this);
block.addVelocityToEntity(this, vector);
}
if (portal) {
inPortalTicks++;
} else {
this.inPortalTicks = 0;
}
if (vector.lengthSquared() > 0) {
vector = vector.normalize();
double d = 0.014d;
this.motionX += vector.x * d;
this.motionY += vector.y * d;
this.motionZ += vector.z * d;
}
}