blueberry.lua 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. local S = farming.intllib
  2. -- blueberries
  3. minetest.register_craftitem("farming:blueberries", {
  4. description = S("Blueberries"),
  5. inventory_image = "farming_blueberries.png",
  6. groups = {food_blueberries = 1, food_blueberry = 1, food_berry = 1, flammable = 2},
  7. on_place = function(itemstack, placer, pointed_thing)
  8. return farming.place_seed(itemstack, placer, pointed_thing, "farming:blueberry_1")
  9. end,
  10. on_use = minetest.item_eat(1),
  11. })
  12. -- blueberry muffin (thanks to sosogirl123 @ deviantart.com for muffin image)
  13. minetest.register_craftitem("farming:muffin_blueberry", {
  14. description = S("Blueberry Muffin"),
  15. inventory_image = "farming_blueberry_muffin.png",
  16. on_use = minetest.item_eat(2),
  17. })
  18. minetest.register_craft({
  19. output = "farming:muffin_blueberry 2",
  20. recipe = {
  21. {"group:food_blueberries", "group:food_bread", "group:food_blueberries"},
  22. }
  23. })
  24. -- Blueberry Pie
  25. minetest.register_craftitem("farming:blueberry_pie", {
  26. description = S("Blueberry Pie"),
  27. inventory_image = "farming_blueberry_pie.png",
  28. on_use = minetest.item_eat(6),
  29. })
  30. minetest.register_craft({
  31. output = "farming:blueberry_pie",
  32. type = "shapeless",
  33. recipe = {
  34. "group:food_flour", "group:food_sugar",
  35. "group:food_blueberries", "group:food_baking_tray"
  36. },
  37. replacements = {{"group:food_baking_tray", "farming:baking_tray"}}
  38. })
  39. -- blueberry definition
  40. local crop_def = {
  41. drawtype = "plantlike",
  42. tiles = {"farming_blueberry_1.png"},
  43. paramtype = "light",
  44. sunlight_propagates = true,
  45. walkable = false,
  46. buildable_to = true,
  47. drop = "",
  48. selection_box = farming.select,
  49. groups = {
  50. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  51. not_in_creative_inventory = 1, growing = 1
  52. },
  53. sounds = default.node_sound_leaves_defaults()
  54. }
  55. -- stage 1
  56. minetest.register_node("farming:blueberry_1", table.copy(crop_def))
  57. -- stage 2
  58. crop_def.tiles = {"farming_blueberry_2.png"}
  59. minetest.register_node("farming:blueberry_2", table.copy(crop_def))
  60. -- stage 3
  61. crop_def.tiles = {"farming_blueberry_3.png"}
  62. minetest.register_node("farming:blueberry_3", table.copy(crop_def))
  63. -- stage 4 (final)
  64. crop_def.tiles = {"farming_blueberry_4.png"}
  65. crop_def.groups.growing = 0
  66. crop_def.drop = {
  67. items = {
  68. {items = {'farming:blueberries 2'}, rarity = 1},
  69. {items = {'farming:blueberries'}, rarity = 2},
  70. {items = {'farming:blueberries'}, rarity = 3},
  71. }
  72. }
  73. minetest.register_node("farming:blueberry_4", table.copy(crop_def))
  74. -- add to registered_plants
  75. farming.registered_plants["farming:blueberries"] = {
  76. crop = "farming:blueberry",
  77. seed = "farming:blueberries",
  78. minlight = 13,
  79. maxlight = 15,
  80. steps = 4
  81. }