private int getFuelTime(ItemStack item) { if (item == null) { return 0; } // CUSTOM FUEL HERE // Lava should melt 128 items, not 100 if (Item.getId(item.getItem()) == org.bukkit.Material.LAVA_BUCKET.getId()) { return 25600; } else { return fuelTime(item); } }
public void tick() { int newID = contents[0] == null ? 0 : Item.getId(contents[0].getItem()); // Has the item been changed? if (newID != lastID) { // Then reset the progress! myCookTime = 0.0D; lastID = newID; // And, most important: change the melt speed meltSpeed = getMeltSpeed(contents[0]); } // So, can we now finally burn? if (canBurn() && !isBurning() && (getFuelTime(contents[1]) > 0)) { // I have no idea what "ticksForCurrentFuel" is good for, but it // works fine like this burnTime = ticksForCurrentFuel = getFuelTime(contents[1]); // Before we remove the item: how fast does it burn? burnSpeed = getBurnSpeed(contents[1]); // If it's a container item (lava bucket), we only consume its // contents (not like evil Notch!) // If it's not a container, consume it! Om nom nom nom! { contents[1].count--; // Let 0 be null if (contents[1].count <= 0) { contents[1] = null; } } } // Now, burning? if (isBurning()) { // Then move on burnTime--; // I'm using a double here because of the custom recipes. // The faster this fuel burns and the faster the recipe melts, the // faster we're done myCookTime += burnSpeed * meltSpeed; // Finished burning? if (myCookTime >= 200.0D) { myCookTime -= 200.0D; burn(); } } // If it's not burning, we reset the burning progress! else { myCookTime = 0.0D; } // And for the display (I'm using floor rather than round to not cause // the client to do shit when we not really reached 200): cookTime = (int) Math.floor(myCookTime); }