2022-10-26 14:44:48 +03:00
|
|
|
local modname = minetest.get_current_modname()
|
|
|
|
local modpath = minetest.get_modpath(modname)
|
2015-06-29 20:55:56 +03:00
|
|
|
|
2022-10-26 14:44:48 +03:00
|
|
|
local S = minetest.get_translator(minetest.get_current_modname())
|
2015-06-29 20:55:56 +03:00
|
|
|
|
2022-10-26 14:44:48 +03:00
|
|
|
if 1 == 1 then
|
|
|
|
minetest.log("action", "[mcl_itemframes] initialized.")
|
2015-06-29 20:55:56 +03:00
|
|
|
end
|
|
|
|
|
2022-10-26 14:44:48 +03:00
|
|
|
-- mcl_itemframes API
|
|
|
|
dofile(modpath .. "/item_frames_API.lua")
|
2018-05-12 20:21:41 +03:00
|
|
|
|
2022-10-26 14:44:48 +03:00
|
|
|
mcl_itemframes.create_base_frames()
|
2015-06-29 20:55:56 +03:00
|
|
|
|
2022-10-26 14:44:48 +03:00
|
|
|
-- Register the base item_frame's recipes.
|
|
|
|
-- was going to make it a specialized function, but minetest refuses to play nice.
|
2017-01-12 04:04:58 +02:00
|
|
|
minetest.register_craft({
|
2022-10-26 14:44:48 +03:00
|
|
|
output = "mcl_itemframes:item_frame",
|
|
|
|
recipe = {
|
|
|
|
{ "mcl_core:stick", "mcl_core:stick", "mcl_core:stick" },
|
|
|
|
{ "mcl_core:stick", "mcl_mobitems:leather", "mcl_core:stick" },
|
|
|
|
{ "mcl_core:stick", "mcl_core:stick", "mcl_core:stick" },
|
|
|
|
}
|
2017-01-12 04:04:58 +02:00
|
|
|
})
|
2018-05-12 19:18:17 +03:00
|
|
|
|
2022-10-26 14:44:48 +03:00
|
|
|
minetest.register_craft({
|
|
|
|
type = "shapeless",
|
|
|
|
output = 'mcl_itemframes:glow_item_frame',
|
|
|
|
recipe = { 'mcl_mobitems:glow_ink_sac', 'mcl_itemframes:item_frame' },
|
2018-05-12 19:50:44 +03:00
|
|
|
})
|
2018-05-13 01:57:32 +03:00
|
|
|
|
2022-10-26 14:44:48 +03:00
|
|
|
-- for compatibility:
|
2019-02-18 22:58:31 +02:00
|
|
|
minetest.register_lbm({
|
2022-10-26 14:44:48 +03:00
|
|
|
label = "Update legacy item frames",
|
|
|
|
name = "mcl_itemframes:update_legacy_item_frames",
|
|
|
|
nodenames = { "itemframes:frame" },
|
|
|
|
action = function(pos, node)
|
|
|
|
-- Swap legacy node, then respawn entity
|
|
|
|
node.name = "mcl_itemframes:item_frame"
|
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
local item = meta:get_string("item")
|
|
|
|
minetest.swap_node(pos, node)
|
|
|
|
if item ~= "" then
|
|
|
|
local itemstack = ItemStack(minetest.deserialize(meta:get_string("itemdata")))
|
|
|
|
local inv = meta:get_inventory()
|
|
|
|
inv:set_size("main", 1)
|
|
|
|
if not itemstack:is_empty() then
|
|
|
|
inv:set_stack("main", 1, itemstack)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
mcl_itemframes.update_item_entity(pos, node)
|
|
|
|
end,
|
2019-02-18 22:58:31 +02:00
|
|
|
})
|
2018-05-13 01:57:32 +03:00
|
|
|
minetest.register_alias("itemframes:frame", "mcl_itemframes:item_frame")
|