auouymous
2021-02-06 0f7810e53895f5742ab577559584539e6533a0dc
commit | author | age
2a2358 1
N 2 local S = technic.getter
3
dd65a6 4 technic.register_recipe_type("extracting", { description = S("Extracting") })
2a2358 5
N 6 function technic.register_extractor_recipe(data)
7     data.time = data.time or 4
aa8af0 8     technic.register_recipe("extracting", data)
2a2358 9 end
N 10
00f61d 11 if minetest.get_modpath("dye") then
T 12     -- check if we are using dye or unifieddyes
13     local unifieddyes = minetest.get_modpath("unifieddyes")
14
15     -- register recipes with the same crafting ratios as `dye` provides
16     local dye_recipes = {
17         {"technic:coal_dust",                 "dye:black 2"},
08b660 18         {"default:blueberries",               "dye:violet 2"},
00f61d 19         {"default:grass_1",                   "dye:green 1"},
T 20         {"default:dry_shrub",                 "dye:brown 1"},
21         {"default:junglegrass",               "dye:green 2"},
22         {"default:cactus",                    "dye:green 4"},
23         {"flowers:geranium",                  "dye:blue 4"},
24         {"flowers:dandelion_white",           "dye:white 4"},
25         {"flowers:dandelion_yellow",          "dye:yellow 4"},
26         {"flowers:tulip",                     "dye:orange 4"},
27         {"flowers:rose",                      "dye:red 4"},
28         {"flowers:viola",                     "dye:violet 4"},
29         {"bushes:blackberry",                 unifieddyes and "unifieddyes:magenta_s50 4" or "dye:violet 4"},
30         {"bushes:blueberry",                  unifieddyes and "unifieddyes:magenta_s50 4" or "dye:magenta 4"},
31     }
32
33     for _, data in ipairs(dye_recipes) do
34         technic.register_extractor_recipe({input = {data[1]}, output = data[2]})
35     end
36
37     -- overwrite the existing crafting recipes
38     local dyes = {"white", "red", "yellow", "blue", "violet", "orange"}
39     for _, color in ipairs(dyes) do
5b97d9 40         minetest.clear_craft({
D 41             type = "shapeless",
42             recipe = {"group:flower,color_"..color},
00f61d 43         })
5b97d9 44         minetest.register_craft({
D 45             type = "shapeless",
46             output = "dye:"..color.." 1",
47             recipe = {"group:flower,color_"..color},
48         })
00f61d 49     end
5b97d9 50
D 51     minetest.clear_craft({
52         type = "shapeless",
53         recipe = {"group:coal"},
54     })
00f61d 55     minetest.register_craft({
T 56         type = "shapeless",
57         output = "dye:black 1",
58         recipe = {"group:coal"},
59     })
60
61     if unifieddyes then
5b97d9 62         minetest.clear_craft({
D 63             type = "shapeless",
64             recipe = {"default:cactus"},
65         })
00f61d 66         minetest.register_craft({
T 67             type = "shapeless",
68             output = "dye:green 1",
69             recipe = {"default:cactus"},
70         })
71     end
72 end