本文整理汇总了Java中cn.nukkit.event.inventory.FurnaceBurnEvent类的典型用法代码示例。如果您正苦于以下问题:Java FurnaceBurnEvent类的具体用法?Java FurnaceBurnEvent怎么用?Java FurnaceBurnEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FurnaceBurnEvent类属于cn.nukkit.event.inventory包,在下文中一共展示了FurnaceBurnEvent类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkFuel
import cn.nukkit.event.inventory.FurnaceBurnEvent; //导入依赖的package包/类
protected void checkFuel(Item fuel) {
FurnaceBurnEvent ev = new FurnaceBurnEvent(this, fuel, fuel.getFuelTime() == null ? 0 : fuel.getFuelTime());
if (ev.isCancelled()) {
return;
}
this.namedTag.putShort("MaxTime", ev.getBurnTime());
this.namedTag.putShort("BurnTime", ev.getBurnTime());
this.namedTag.putShort("BurnDuration", 0);
if (this.getBlock().getId() == Item.FURNACE) {
this.getLevel().setBlock(this, new BlockFurnaceBurning(this.getBlock().getDamage()), true);
}
if (this.namedTag.getShort("BurnTime") > 0 && ev.isBurning()) {
fuel.setCount(fuel.getCount() - 1);
if (fuel.getCount() == 0) {
fuel = new ItemBlock(new BlockAir(), 0, 0);
}
this.inventory.setFuel(fuel);
}
}
示例2: checkFuel
import cn.nukkit.event.inventory.FurnaceBurnEvent; //导入依赖的package包/类
protected void checkFuel(Item fuel) {
FurnaceBurnEvent ev = new FurnaceBurnEvent(this, fuel, fuel.getFuelTime() == null ? 0 : fuel.getFuelTime());
if (ev.isCancelled()) {
return;
}
maxTime = ev.getBurnTime();
burnTime = ev.getBurnTime();
burnDuration = 0;
if (this.getBlock().getId() == Item.FURNACE) {
this.getLevel().setBlock(this, new BlockFurnaceBurning(this.getBlock().getDamage()), true);
}
if (burnTime > 0 && ev.isBurning()) {
fuel.setCount(fuel.getCount() - 1);
if (fuel.getCount() == 0) {
fuel = new ItemBlock(new BlockAir(), 0, 0);
}
this.inventory.setFuel(fuel);
}
}
示例3: checkFuel
import cn.nukkit.event.inventory.FurnaceBurnEvent; //导入依赖的package包/类
protected void checkFuel(Item fuel) {
FurnaceBurnEvent ev = new FurnaceBurnEvent(this, fuel, fuel.getFuelTime() == null ? 0 : fuel.getFuelTime());
if (ev.isCancelled()) {
return;
}
maxTime = ev.getBurnTime();
burnTime = ev.getBurnTime();
burnDuration = 0;
if (this.getBlock().getId() == Item.FURNACE) {
this.getLevel().setBlock(this, new BlockFurnaceBurning(this.getBlock().getDamage()), true);
}
if (burnTime > 0 && ev.isBurning()) {
fuel.setCount(fuel.getCount() - 1);
if (fuel.getCount() == 0) {
if (fuel.getId() == Item.BUCKET && fuel.getDamage() == 10) {
fuel.setDamage(0);
fuel.setCount(1);
} else {
fuel = new ItemBlock(new BlockAir(), 0, 0);
}
}
this.inventory.setFuel(fuel);
}
}