如何获得燃料源的燃烧时间?



我正在使用Material.{something}.isFuel()来获取物品是否是燃料来源,但是我如何获得该燃料源的燃烧时间......?

据我所知,没有这样的事情。 但是您可以创建一个包含燃料信息的枚举,如以下龙头文章所示:

public enum Fuel {
LAVA_BUCKET(Material.LAVA_BUCKET, 20000),
COAL_BLOCK(Material.COAL_BLOCK, 16000),
BLAZE_ROD(Material.BLAZE_ROD, 2400)
// ...
private Material type;
private int burntime;
public Fuel(Material type, int burntime) {
this.type = type;
this.burntime = burntime;
}
public int getBurnTime() {
return burntime;
}
}

链接到Spigot 文章

最新更新