Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Alternative by NakedFury
- With help from: thexyz
- Wood Buckets
- Version 1.0
- License: GNU GPLv3
- Date: 10/12/2012
- --]]
- altwood = {}
- altw.liquids = {}
- minetest.register_craft({
- output = 'alternative:wood_bucket 1',
- recipe = {
- {'default:wood', '', 'default:wood'},
- {'', 'default:wood', ''},
- }
- })
- function altwood.register_liquid(source, flowing, itemname, inventory_image)
- altw.liquids[source] = {
- source = source,
- flowing = flowing,
- itemname = itemname,
- }
- altw.liquids[flowing] = altw.liquids[source]
- if itemname ~= nil then
- minetest.register_craftitem(itemname, {
- inventory_image = inventory_image,
- stack_max = 1,
- liquids_pointable = true,
- on_use = function(itemstack, user, pointed_thing)
- -- Must be pointing to node
- if pointed_thing.type ~= "node" then
- return
- end
- -- Check if pointing to a liquid
- n = minetest.env:get_node(pointed_thing.under)
- if altw.liquids[n.name] == nil then
- -- Not a liquid
- minetest.env:add_node(pointed_thing.above, {name=water_source})
- elseif n.name ~= source then
- -- It's a liquid
- minetest.env:add_node(pointed_thing.under, {name=water_ source})
- end
- return {name="alternative:wood_bucket"}
- end
- })
- end
- end
- minetest.register_craftitem("alternative:wood_bucket", {
- description = "Wood bucket",
- inventory_image = "alternative_wood_bucket.png",
- stack_max = 1,
- liquids_pointable = true,
- on_use = function(itemstack, user, pointed_thing)
- -- Must be pointing to node
- if pointed_thing.type ~= "node" then
- return
- end
- -- Check if pointing to a liquid source
- n = minetest.env:get_node(pointed_thing.under)
- liquiddef = altw.liquids[n.name]
- if liquiddef ~= nil and liquiddef.source == n.name and liquiddef.itemname ~= nil then
- minetest.env:add_node(pointed_thing.under, {name="air"})
- return {name=liquiddef.itemname}
- end
- end,
- })
- altwood.register_liquid(
- "default:water_source",
- "default:water_flowing",
- "alternative:wood_bucket_water",
- "alternative_wood_bucket_water.png"
- )
- minetest.register_craft({
- type = "fuel",
- recipe = "alternative:wood_bucket",
- burntime = 4,
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement