init.lua 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. -- This uses a trick: you can first define the recipes using all of the base
  2. -- colors, and then some recipes using more specific colors for a few non-base
  3. -- colors available. When crafting, the last recipes will be checked first.
  4. local dyes = {
  5. {"white", "White", "basecolor_white"},
  6. {"grey", "Grey", "basecolor_grey"},
  7. {"black", "Black", "basecolor_black"},
  8. {"red", "Red", "basecolor_red"},
  9. {"yellow", "Yellow", "basecolor_yellow"},
  10. {"green", "Green", "basecolor_green"},
  11. {"cyan", "Cyan", "basecolor_cyan"},
  12. {"blue", "Blue", "basecolor_blue"},
  13. {"magenta", "Magenta", "basecolor_magenta"},
  14. {"orange", "Orange", "excolor_orange"},
  15. {"violet", "Violet", "excolor_violet"},
  16. {"brown", "Brown", "unicolor_dark_orange"},
  17. {"pink", "Pink", "unicolor_light_red"},
  18. {"dark_grey", "Dark Grey", "unicolor_darkgrey"},
  19. {"dark_green", "Dark Green", "unicolor_dark_green"},
  20. }
  21. for i = 1, #dyes do
  22. local name, desc, craft_color_group = unpack(dyes[i])
  23. minetest.register_node("wool:" .. name, {
  24. description = desc .. " Wool",
  25. tiles = {"wool_" .. name .. ".png"},
  26. is_ground_content = false,
  27. groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3,
  28. flammable = 3, wool = 1},
  29. sounds = default.node_sound_defaults(),
  30. })
  31. minetest.register_craft{
  32. type = "shapeless",
  33. output = "wool:" .. name,
  34. recipe = {"group:dye," .. craft_color_group, "group:wool"},
  35. }
  36. end
  37. -- legacy
  38. -- Backwards compatibility with jordach's 16-color wool mod
  39. minetest.register_alias("wool:dark_blue", "wool:blue")
  40. minetest.register_alias("wool:gold", "wool:yellow")