当前位置: 首页>>代码示例>>Java>>正文


Java FurnaceBurnEvent类代码示例

本文整理汇总了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);
        }
    }
 
开发者ID:Creeperface01,项目名称:NukkitGT,代码行数:24,代码来源:BlockEntityFurnace.java

示例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);
        }
    }
 
开发者ID:NycuRO,项目名称:Apollo-OLD,代码行数:24,代码来源:BlockEntityFurnace.java

示例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);
        }
    }
 
开发者ID:Nukkit,项目名称:Nukkit,代码行数:29,代码来源:BlockEntityFurnace.java


注:本文中的cn.nukkit.event.inventory.FurnaceBurnEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。