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


Java FurnaceBurnEvent.getBurnTime方法代码示例

本文整理汇总了Java中org.bukkit.event.inventory.FurnaceBurnEvent.getBurnTime方法的典型用法代码示例。如果您正苦于以下问题:Java FurnaceBurnEvent.getBurnTime方法的具体用法?Java FurnaceBurnEvent.getBurnTime怎么用?Java FurnaceBurnEvent.getBurnTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.event.inventory.FurnaceBurnEvent的用法示例。


在下文中一共展示了FurnaceBurnEvent.getBurnTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: h

import org.bukkit.event.inventory.FurnaceBurnEvent; //导入方法依赖的package包/类
public void h() {
    boolean flag = this.burnTime > 0;
    boolean flag1 = false;

    // CraftBukkit start - Use wall time instead of ticks for cooking
    int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
    this.lastTick = MinecraftServer.currentTick;

    // CraftBukkit - moved from below
    if (this.isBurning() && this.canBurn()) {
        this.cookTime += elapsedTicks;
        if (this.cookTime >= 200) {
            this.cookTime %= 200;
            this.burn();
            flag1 = true;
        }
    } else {
        this.cookTime = 0;
    }
    // CraftBukkit end

    if (this.burnTime > 0) {
        this.burnTime -= elapsedTicks; // CraftBukkit - use elapsedTicks in place of constant
    }

    if (!this.world.isStatic) {
        if (this.burnTime != 0 || this.items[1] != null && this.items[0] != null) {
            // CraftBukkit start - Handle multiple elapsed ticks
            if (this.burnTime <= 0 && this.canBurn()) { // CraftBukkit - == to <=
                CraftItemStack fuel = CraftItemStack.asCraftMirror(this.items[1]);

                FurnaceBurnEvent furnaceBurnEvent = new FurnaceBurnEvent(this.world.getWorld().getBlockAt(this.x, this.y, this.z), fuel, fuelTime(this.items[1]));
                this.world.getServer().getPluginManager().callEvent(furnaceBurnEvent);

                if (furnaceBurnEvent.isCancelled()) {
                    return;
                }

                this.ticksForCurrentFuel = furnaceBurnEvent.getBurnTime();
                this.burnTime += this.ticksForCurrentFuel;
                if (this.burnTime > 0 && furnaceBurnEvent.isBurning()) {
                    // CraftBukkit end
                    flag1 = true;
                    if (this.items[1] != null) {
                        --this.items[1].count;
                        if (this.items[1].count == 0) {
                            Item item = this.items[1].getItem().t();

                            this.items[1] = item != null ? new ItemStack(item) : null;
                        }
                    }
                }
            }

            /* CraftBukkit start - Moved up
            if (this.isBurning() && this.canBurn()) {
                ++this.cookTime;
                if (this.cookTime == 200) {
                    this.cookTime = 0;
                    this.burn();
                    flag1 = true;
                }
            } else {
                this.cookTime = 0;
            }
            */
        }

        if (flag != this.burnTime > 0) {
            flag1 = true;
            BlockFurnace.a(this.burnTime > 0, this.world, this.x, this.y, this.z);
        }
    }

    if (flag1) {
        this.update();
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:79,代码来源:TileEntityFurnace.java

示例2: h

import org.bukkit.event.inventory.FurnaceBurnEvent; //导入方法依赖的package包/类
public void h() {
    boolean flag = this.burnTime > 0;
    boolean flag1 = false;

    // CraftBukkit start - Use wall time instead of ticks for cooking
    int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
    this.lastTick = MinecraftServer.currentTick;

    // CraftBukkit - moved from below
    if (this.isBurning() && this.canBurn()) {
        this.cookTime += elapsedTicks;
        if (this.cookTime >= 200) {
            this.cookTime %= 200;
            this.burn();
            flag1 = true;
        }
    } else {
        this.cookTime = 0;
    }
    // CraftBukkit end

    if (this.burnTime > 0) {
        this.burnTime -= elapsedTicks; // CraftBukkit
    }

    if (!this.world.isStatic) {
        // CraftBukkit start - Handle multiple elapsed ticks
        if (this.burnTime <= 0 && this.canBurn() && this.items[1] != null) { // CraftBukkit - == to <=
            CraftItemStack fuel = CraftItemStack.asCraftMirror(this.items[1]);

            FurnaceBurnEvent furnaceBurnEvent = new FurnaceBurnEvent(this.world.getWorld().getBlockAt(this.x, this.y, this.z), fuel, fuelTime(this.items[1]));
            this.world.getServer().getPluginManager().callEvent(furnaceBurnEvent);

            if (furnaceBurnEvent.isCancelled()) {
                return;
            }

            this.ticksForCurrentFuel = furnaceBurnEvent.getBurnTime();
            this.burnTime += this.ticksForCurrentFuel;
            if (this.burnTime > 0 && furnaceBurnEvent.isBurning()) {
                // CraftBukkit end
                flag1 = true;
                if (this.items[1] != null) {
                    --this.items[1].count;
                    if (this.items[1].count == 0) {
                        Item item = this.items[1].getItem().t();

                        this.items[1] = item != null ? new ItemStack(item) : null;
                    }
                }
            }
        }

        /* CraftBukkit start - Moved up
        if (this.isBurning() && this.canBurn()) {
            ++this.cookTime;
            if (this.cookTime == 200) {
                this.cookTime = 0;
                this.burn();
                flag1 = true;
            }
        } else {
            this.cookTime = 0;
        }
        // CraftBukkit end */

        if (flag != this.burnTime > 0) {
            flag1 = true;
            BlockFurnace.a(this.burnTime > 0, this.world, this.x, this.y, this.z);
        }
    }

    if (flag1) {
        this.update();
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:77,代码来源:TileEntityFurnace.java

示例3: h

import org.bukkit.event.inventory.FurnaceBurnEvent; //导入方法依赖的package包/类
public void h() {
    boolean flag = this.burnTime > 0;
    boolean flag1 = false;

    // CraftBukkit start - Use wall time instead of ticks for cooking
    int elapsedTicks = Math.max(1, MinecraftServer.currentTick - this.lastTick);
    this.lastTick = MinecraftServer.currentTick;

    // CraftBukkit - moved from below
    if (this.isBurning() && this.canBurn()) {
        this.cookTime += elapsedTicks;
        if (this.cookTime >= 200) {
            this.cookTime %= 200;
            this.burn();
            flag1 = true;
        }
    } else {
        this.cookTime = 0;
    }
    // CraftBukkit end

    if (this.burnTime > 0) {
        this.burnTime -= elapsedTicks; // CraftBukkit
    }

    if (!this.world.isStatic) {
        // CraftBukkit start - Handle multiple elapsed ticks
        if (this.burnTime <= 0 && this.canBurn() && this.items[1] != null) { // CraftBukkit - == to <=
            CraftItemStack fuel = CraftItemStack.asCraftMirror(this.items[1]);

            FurnaceBurnEvent furnaceBurnEvent = new FurnaceBurnEvent(this.world.getWorld().getBlockAt(this.x, this.y, this.z), fuel, fuelTime(this.items[1]));
            this.world.getServer().getPluginManager().callEvent(furnaceBurnEvent);

            if (furnaceBurnEvent.isCancelled()) {
                return;
            }

            this.ticksForCurrentFuel = furnaceBurnEvent.getBurnTime();
            this.burnTime += this.ticksForCurrentFuel;
            if (this.burnTime > 0 && furnaceBurnEvent.isBurning()) {
                // CraftBukkit end
                flag1 = true;
                if (this.items[1] != null) {
                    --this.items[1].count;
                    if (this.items[1].count == 0) {
                        Item item = this.items[1].getItem().s();

                        this.items[1] = item != null ? new ItemStack(item) : null;
                    }
                }
            }
        }

        /* CraftBukkit start - Moved up
        if (this.isBurning() && this.canBurn()) {
            ++this.cookTime;
            if (this.cookTime == 200) {
                this.cookTime = 0;
                this.burn();
                flag1 = true;
            }
        } else {
            this.cookTime = 0;
        }
        // CraftBukkit end */

        if (flag != this.burnTime > 0) {
            flag1 = true;
            BlockFurnace.a(this.burnTime > 0, this.world, this.x, this.y, this.z);
        }
    }

    if (flag1) {
        this.update();
    }
}
 
开发者ID:didoupimpon,项目名称:Craft-city,代码行数:77,代码来源:TileEntityFurnace.java


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