[ethereal] bonemeal.lua: Load craft recipes after items/nodes

registration.
master
AntumDeluge 2016-09-05 06:23:33 -07:00
parent 3a922065a0
commit 0844f44e57
1 changed files with 32 additions and 31 deletions

View File

@ -12,6 +12,38 @@ else
})
end
-- bonemeal item
minetest.register_craftitem("ethereal:bonemeal", {
description = S("Bone Meal"),
inventory_image = "bonemeal.png",
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type == "node" then
-- Check if node protected
if minetest.is_protected(pointed_thing.under, user:get_player_name()) then
return
end
if not minetest.setting_getbool("creative_mode") then
local item = user:get_wielded_item()
item:take_item()
user:set_wielded_item(item)
end
growth(pointed_thing)
itemstack:take_item()
return itemstack
end
end,
})
-- bonemeal recipes
minetest.register_craft({
type = "shapeless",
@ -269,34 +301,3 @@ local function growth(pointed_thing)
end
end
end
-- bonemeal item
minetest.register_craftitem("ethereal:bonemeal", {
description = S("Bone Meal"),
inventory_image = "bonemeal.png",
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type == "node" then
-- Check if node protected
if minetest.is_protected(pointed_thing.under, user:get_player_name()) then
return
end
if not minetest.setting_getbool("creative_mode") then
local item = user:get_wielded_item()
item:take_item()
user:set_wielded_item(item)
end
growth(pointed_thing)
itemstack:take_item()
return itemstack
end
end,
})