本文整理汇总了Java中cn.nukkit.event.block.BlockFromToEvent类的典型用法代码示例。如果您正苦于以下问题:Java BlockFromToEvent类的具体用法?Java BlockFromToEvent怎么用?Java BlockFromToEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BlockFromToEvent类属于cn.nukkit.event.block包,在下文中一共展示了BlockFromToEvent类的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);
}
}
}
}