api.txt 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. Bonemeal API
  2. ============
  3. This guide will show you how to add saplings, crops and dirt types for the
  4. bonemeal mod to use from withhin your own mods. Please make sure that bonemeal
  5. appears in the depends.txt file of your mod so everything work properly.
  6. Function Usage
  7. ==============
  8. Adding Crops
  9. ------------
  10. bonemeal:add_crop({
  11. { nodename_start, growing_steps, seed_name }
  12. })
  13. This command is used to add new crops for bonemeal to work on.
  14. e.g.
  15. bonemeal:add_crop({
  16. {"farming:cotton_", 8, "farming:seed_cotton"},
  17. {"farming:wheat_", 8, "farming:seed_wheat"},
  18. })
  19. Adding Saplings
  20. ---------------
  21. bonemeal:add_sapling({
  22. { sapling_node, function, soil_type[sand, dirt, nodename] }
  23. })
  24. This command will add new saplings for bonemeal to grow on sand, soil or a
  25. specified node type.
  26. bonemeal:add_sapling({
  27. {"ethereal:palm_sapling", ethereal.grow_palm_tree, "soil"},
  28. {"ethereal:palm_sapling", ethereal.grow_palm_tree, "sand"},
  29. })
  30. Adding Dirt Decoration
  31. ----------------------
  32. bonemeal:add_deco({
  33. { dirt_node, {grass_node_list}, {decor_node_list} }
  34. })
  35. This command will add grass and decoration to specific dirt types, use "" to
  36. add an empty node. If some decorations have been already defined for this dirt type, new
  37. will be added to the respective list. All empty ("") entries will be added regardless,
  38. which allows to decrease the frequency of decoration emergence, if needed.
  39. e.g.
  40. bonemeal:add_deco({
  41. {"default:dirt_with_dry_grass", {"default:dry_grass_1", ""},
  42. {"flowers:rose", "flowers:viola"} }
  43. })
  44. Thus, add_deco() always adds (to) a definition, and never overrides. To discard an existing
  45. definiton in favor of the new one, use
  46. bonemeal:set_deco({
  47. { dirt_node, {grass_node_list}, {decor_node_list} }
  48. })
  49. This command will set decoration for a given dirt type, fully replacing any existing definition.
  50. Global ON_USE Function
  51. ----------------------
  52. bonemeal:on_use(pos, strength, node)
  53. This function can be called from other mods to grow plants using alternative
  54. bonemeal items and have the same effect.
  55. {pos} is the location to apply growing
  56. {strength} is how strong to grow [low of 1 to high of 4]
  57. {node} is the node at pos, but can be left nil to get_node itself
  58. Note: Higher strength items require lower light levels, and a strength of 4
  59. needs no light at all.
  60. Final Words
  61. ===========
  62. I hope this guide helps you add your own plants so you can grow them quickly
  63. with the items included. Please check the mods.lua for more examples.