}
})
+minetest.register_craft({
+ output = "xdecor:enchantment_table",
+ recipe = {
+ {"", "default:book", ""},
+ {"default:diamond", "default:obsidian", "default:diamond"},
+ {"default:obsidian", "default:obsidian", "default:obsidian"}
+ }
+})
+
minetest.register_craft({
output = "xdecor:fence_wrought_iron 2",
recipe = {
--- /dev/null
+local function enchconstruct(pos)
+ local meta = minetest.get_meta(pos)
+ meta:set_string("formspec", "size[8,7;]"..xdecor.fancy_gui..
+ "label[0.65,-0.15;Enchant]"..
+ "image[0.4,0.2;2,2;default_book.png]"..
+ "list[current_name;tool;0.3,2;1,1;]"..
+ "list[current_name;mese;1.3,2;1,1;]"..
+ "image_button[2.5,0;5.3,1.1;bg.png;durable;Durable]"..
+ "image_button[2.5,1;5.3,1.1;bg.png;fast;Fast]"..
+ "image_button[2.5,2;5.3,1.1;bg.png;luck;Luck]"..
+ "list[current_player;main;0,3.3;8,4;]")
+ meta:set_string("infotext", "Enchantment Table")
+
+ local inv = meta:get_inventory()
+ inv:set_size("tool", 1)
+ inv:set_size("mese", 1)
+end
+
+local function enchdig(pos, player)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+
+ if not inv:is_empty("tool") or not inv:is_empty("mese") then
+ return false
+ end
+ return true
+end
+
+local function enchput(pos, listname, index, stack, player)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+
+ if listname == "mese" then
+ if stack:get_name() == "default:mese_crystal" then
+ return stack:get_count()
+ else
+ return 0
+ end
+ end
+ if listname == "tool" then
+ local tname = stack:get_name()
+ local tdef = minetest.registered_tools[tname]
+
+ if tdef then return 1 else return 0 end
+ end
+
+ return stack:get_count()
+end
+
+xdecor.register("enchantment_table", {
+ description = "Enchantment Table",
+ tiles = {
+ "xdecor_enchantment_top.png",
+ "xdecor_enchantment_bottom.png",
+ "xdecor_enchantment_side.png",
+ "xdecor_enchantment_side.png",
+ "xdecor_enchantment_side.png",
+ "xdecor_enchantment_side.png",
+ },
+ groups = {cracky=1},
+ sounds = xdecor.stone,
+ on_construct = enchconstruct,
+ can_dig = enchdig,
+ allow_metadata_inventory_put = enchput
+})
local material = {
"cloud", -- Only used for the formspec display.
- "wood", "junglewood", "pinewood",
- "tree", "jungletree", "pinetree",
+ "wood", "junglewood", "pinewood", "acacia_wood",
+ "tree", "jungletree", "pinetree", "acacia_tree",
"cobble", "mossycobble", "desert_cobble",
"stone", "sandstone", "desert_stone", "obsidian",
"stonebrick", "sandstonebrick", "desert_stonebrick", "obsidianbrick",
local w = def[n]
local nodename = "default:"..v
local ndef = minetest.registered_nodes[nodename]
-
- xdecor.register(w[1].."_"..v, {
- description = string.sub(string.upper(w[1]), 0, 1)..
- string.sub(w[1], 2),
- light_source = ndef.light_source,
- sounds = ndef.sounds,
- tiles = ndef.tiles,
- groups = {snappy=3, not_in_creative_inventory=1},
- node_box = {
- type = "fixed",
- fixed = w[3]
- },
- on_place = minetest.rotate_node
- })
+
+ if ndef then
+ xdecor.register(w[1].."_"..v, {
+ description = string.sub(string.upper(w[1]), 0, 1)..
+ string.sub(w[1], 2),
+ light_source = ndef.light_source,
+ sounds = ndef.sounds,
+ tiles = ndef.tiles,
+ groups = {snappy=3, not_in_creative_inventory=1},
+ node_box = {
+ type = "fixed",
+ fixed = w[3]
+ },
+ on_place = minetest.rotate_node
+ })
+ end
end
end