Bucket preservation when using lava buckets as fuel
One of the things that bugs me about using lava buckets in the furnace is that the bucket is always consumed in the process; it seems to me like a bit of a waste. I'm not sure what the "official" view of burning buckets along with the lava as fuel is, but in the mean time I managed to "fix" the issue and change the game's mods on my testing copy to consume only the lava and leave an empty bucket behind. I basically had to change two things:
1. I added support for craft formula replacements in the default mod by setting the output value of the fuel to the "decremented input" return value of get_craft_result rather than the input stack with one item removed:
2. Then, I added a line to the fuel craft definition for the lava bucket in the bucket mod to replace the lava with an empty bucket:
In any case, something along the lines of the changes that I made to the default mod should probably be implemented in the official version so that other mods will be able to supply fuel to furnaces without using up containers. In this case, I'm not seeing any reason for burning the buckets along with the lava when smelting, but then the changes were easy enough to make that I wonder why no-one else seems to have made them yet…
1. I added support for craft formula replacements in the default mod by setting the output value of the fuel to the "decremented input" return value of get_craft_result rather than the input stack with one item removed:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
(around line 1500)
local fuel = nil
local cooked = nil
local fuellist = inv:get_list("fuel")
local srclist = inv:get_list("src")
--to--
local fuel = nil
local afterfuel
local cooked = nil
local fuellist = inv:get_list("fuel")
local srclist = inv:get_list("src")
fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
--to--
fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
local stack = inv:get_stack("fuel", 1)
stack:take_item()
inv:set_stack("fuel", 1, stack)
--to--
inv:set_stack("fuel", 1, afterfuel.items[1])
2. Then, I added a line to the fuel craft definition for the lava bucket in the bucket mod to replace the lava with an empty bucket:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
(line 103)
minetest.register_craft({
type = "fuel",
recipe = "bucket:bucket_lava",
burntime = 60,
})
--to--
minetest.register_craft({
type = "fuel",
recipe = "bucket:bucket_lava",
burntime = 60,
replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}},
})
In any case, something along the lines of the changes that I made to the default mod should probably be implemented in the official version so that other mods will be able to supply fuel to furnaces without using up containers. In this case, I'm not seeing any reason for burning the buckets along with the lava when smelting, but then the changes were easy enough to make that I wonder why no-one else seems to have made them yet…