init.lua 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. -- Other mods can use these for looping through available colors
  2. dye = {}
  3. -- Note: there is another color list in the "bakedclay" mod which must be same
  4. -- as this. Also in the "wool" mod.
  5. local dyes = {
  6. {"white", "White Dye", {dye=1}},
  7. {"grey", "Grey Dye", {dye=1}},
  8. {"dark_grey", "Dark Grey Dye", {dye=1}},
  9. {"black", "Black Dye", {dye=1}},
  10. {"violet", "Violet Dye", {dye=1}},
  11. {"blue", "Blue Dye", {dye=1}},
  12. {"cyan", "Cyan Dye", {dye=1}},
  13. {"dark_green", "Dark Green Dye", {dye=1}},
  14. {"green", "Green Dye", {dye=1}},
  15. {"yellow", "Yellow Dye", {dye=1}},
  16. {"brown", "Brown Dye", {dye=1}},
  17. {"orange", "Orange Dye", {dye=1}},
  18. {"red", "Red Dye", {dye=1}},
  19. {"magenta", "Magenta Dye", {dye=1}},
  20. {"pink", "Pink Dye", {dye=1}},
  21. }
  22. -- Define items.
  23. for _, row in ipairs(dyes) do
  24. local name = row[1]
  25. local description = row[2]
  26. local groups = row[3]
  27. local item_name = "dye:" .. name
  28. local item_image = "dye_" .. name .. ".png"
  29. minetest.register_craftitem(item_name, {
  30. inventory_image = item_image,
  31. description = description,
  32. groups = groups,
  33. })
  34. minetest.register_craft({
  35. type = "shapeless",
  36. output = item_name .. " 1",
  37. recipe = {"group:flower,color_" .. name, "farming:mortar_pestle"},
  38. replacements = {{"farming:mortar_pestle", "farming:mortar_pestle"}},
  39. })
  40. end
  41. -- Manually add coal --> black dye.
  42. minetest.register_craft({
  43. type = "shapeless",
  44. output = "dye:black",
  45. recipe = {"default:coal_lump", "default:clay_lump", "farming:mortar_pestle"},
  46. replacements = {{"farming:mortar_pestle", "farming:mortar_pestle"}},
  47. })
  48. -- Mix recipes. Table params: color1, color2, result.
  49. local dye_recipes = {
  50. -- Basic RYB mixes.
  51. {"red", "blue", "violet" },
  52. {"yellow", "red", "orange" },
  53. {"yellow", "blue", "green" },
  54. -- RYB complementary mixes.
  55. {"yellow", "violet", "dark_grey" },
  56. {"blue", "orange", "dark_grey" },
  57. -- CMY mixes - approximation.
  58. {"cyan", "yellow", "green" },
  59. {"cyan", "magenta", "blue" },
  60. {"yellow", "magenta", "red" },
  61. -- Other mixes that result in a color we have.
  62. {"red", "green", "brown" },
  63. {"magenta", "blue", "violet" },
  64. {"green", "blue", "cyan" },
  65. {"pink", "violet", "magenta" },
  66. -- Mixes with black.
  67. {"white", "black", "grey" },
  68. {"grey", "black", "dark_grey" },
  69. {"green", "black", "dark_green"},
  70. {"orange", "black", "brown" },
  71. -- Mixes with white.
  72. {"white", "red", "pink" },
  73. {"white", "dark_grey", "grey" },
  74. {"white", "dark_green", "green" },
  75. }
  76. for _, mix in ipairs(dye_recipes) do
  77. minetest.register_craft({
  78. type = "shapeless",
  79. output = 'dye:' .. mix[3] .. ' 2',
  80. recipe = {'dye:' .. mix[1], 'dye:' .. mix[2]},
  81. })
  82. end