本文整理汇总了Java中cn.nukkit.event.block.BlockFromToEvent.isCancelled方法的典型用法代码示例。如果您正苦于以下问题:Java BlockFromToEvent.isCancelled方法的具体用法?Java BlockFromToEvent.isCancelled怎么用?Java BlockFromToEvent.isCancelled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.event.block.BlockFromToEvent
的用法示例。
在下文中一共展示了BlockFromToEvent.isCancelled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkForHarden
import cn.nukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
private void checkForHarden() {
if (this instanceof BlockLava) {
boolean colliding = false;
for (BlockFace face : BlockFace.values()) {
if (colliding = this.getSide(face) instanceof BlockWater) {
break;
}
}
if (colliding) {
Block to;
if (this.getDamage() == 0) {
to = new BlockObsidian();
} else if (this.getDamage() <= 4) {
to = new BlockCobblestone();
} else {
return;
}
to.setComponents(this.getX(), this.getY(), this.getZ());
to.setLevel(this.getLevel());
BlockFromToEvent ev = new BlockFromToEvent(this, to);
this.getLevel().getServer().getPluginManager().callEvent(ev);
if (!ev.isCancelled()) {
this.getLevel().setBlock(this, ev.getTo(), true);
this.triggerLavaMixEffects(this);
}
}
}
}
示例2: checkForHarden
import cn.nukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
private void checkForHarden() {
if (this instanceof BlockLava) {
boolean colliding = false;
for (int side = 0; side <= 5 && !colliding; ++side) {
colliding = this.getSide(side) instanceof BlockWater;
}
if (colliding) {
Block to;
if (this.getDamage() == 0) {
to = new BlockObsidian();
} else if (this.getDamage() <= 4) {
to = new BlockCobblestone();
} else {
return;
}
to.setComponents(this.getX(), this.getY(), this.getZ());
to.setLevel(this.getLevel());
BlockFromToEvent ev = new BlockFromToEvent(this, to);
this.getLevel().getServer().getPluginManager().callEvent(ev);
if (!ev.isCancelled()) {
this.getLevel().setBlock(this, ev.getTo(), true);
this.triggerLavaMixEffects(this);
}
}
}
}