api.lua 592 B

1234567891011121314151617181920
  1. local recipes = {}
  2. repairing_anvils.recipes = recipes
  3. function repairing_anvils.register_recipe(input, output)
  4. assert(type(input) == "string",
  5. "Error registering anvil recipe: Input must be a string, was " ..
  6. type(input))
  7. assert(type(output) == "string" or
  8. type(output) == "function",
  9. "Error registering anvil recipe: output must be a string of function, was" ..
  10. type(output))
  11. assert(not recipes[input], "There is already an anvil recipe registered for " ..
  12. input)
  13. recipes[minetest.registered_aliases[input] or input] =
  14. minetest.registered_aliases[output] or output
  15. end