本文整理汇总了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();
}
}
示例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();
}
}
示例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();
}
}