blueberry.lua 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. local S = farming.translate
  2. -- blueberries
  3. minetest.register_craftitem("farming:blueberries", {
  4. description = S("Wild Blueberries"),
  5. inventory_image = "farming_blueberries.png",
  6. groups = {
  7. compostability = 48, seed = 2, food_blueberries = 1, food_blueberry = 1,
  8. food_berry = 1, flammable = 2
  9. },
  10. on_place = function(itemstack, placer, pointed_thing)
  11. return farming.place_seed(itemstack, placer, pointed_thing, "farming:blueberry_1")
  12. end,
  13. on_use = minetest.item_eat(1)
  14. })
  15. -- blueberry muffin (thanks to sosogirl123 @ deviantart.com for muffin image)
  16. minetest.register_craftitem("farming:muffin_blueberry", {
  17. description = S("Blueberry Muffin"),
  18. inventory_image = "farming_blueberry_muffin.png",
  19. on_use = minetest.item_eat(2),
  20. groups = {compostability = 65}
  21. })
  22. minetest.register_craft({
  23. output = "farming:muffin_blueberry 2",
  24. recipe = {
  25. {"group:food_blueberries", "group:food_bread", "group:food_blueberries"}
  26. }
  27. })
  28. -- Blueberry Pie
  29. minetest.register_craftitem("farming:blueberry_pie", {
  30. description = S("Blueberry Pie"),
  31. inventory_image = "farming_blueberry_pie.png",
  32. on_use = minetest.item_eat(6),
  33. groups = {compostability = 75}
  34. })
  35. local tmp = farming.use_utensils and "farming:baking_tray" or ""
  36. minetest.register_craft({
  37. output = "farming:blueberry_pie",
  38. recipe = {
  39. {"group:food_flour", "group:food_sugar", "group:food_blueberries"},
  40. {"", tmp, ""}
  41. },
  42. replacements = {{"group:food_baking_tray", "farming:baking_tray"}}
  43. })
  44. -- Blue Dye
  45. minetest.register_craft({
  46. output = farming.mcl and "mcl_dye:blue" or "dye:blue",
  47. recipe = {{"farming:blueberries"}}
  48. })
  49. -- blueberry definition
  50. local def = {
  51. drawtype = "plantlike",
  52. tiles = {"farming_blueberry_1.png"},
  53. paramtype = "light",
  54. sunlight_propagates = true,
  55. walkable = false,
  56. buildable_to = true,
  57. drop = "",
  58. selection_box = farming.select,
  59. groups = {
  60. handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  61. not_in_creative_inventory = 1, growing = 1
  62. },
  63. sounds = farming.sounds.node_sound_leaves_defaults()
  64. }
  65. -- stage 1
  66. minetest.register_node("farming:blueberry_1", table.copy(def))
  67. -- stage 2
  68. def.tiles = {"farming_blueberry_2.png"}
  69. minetest.register_node("farming:blueberry_2", table.copy(def))
  70. -- stage 3
  71. def.tiles = {"farming_blueberry_3.png"}
  72. minetest.register_node("farming:blueberry_3", table.copy(def))
  73. -- stage 4 (final)
  74. def.tiles = {"farming_blueberry_4.png"}
  75. def.groups.growing = nil
  76. def.selection_box = farming.select_final
  77. def.drop = {
  78. items = {
  79. {items = {"farming:blueberries 2"}, rarity = 1},
  80. {items = {"farming:blueberries"}, rarity = 2},
  81. {items = {"farming:blueberries"}, rarity = 3}
  82. }
  83. }
  84. minetest.register_node("farming:blueberry_4", table.copy(def))
  85. -- add to registered_plants
  86. farming.registered_plants["farming:blueberries"] = {
  87. crop = "farming:blueberry",
  88. seed = "farming:blueberries",
  89. minlight = farming.min_light,
  90. maxlight = farming.max_light,
  91. steps = 4
  92. }
  93. -- mapgen
  94. minetest.register_decoration({
  95. deco_type = "simple",
  96. place_on = {"mcl_core:dirt_with_grass, default:dirt_with_grass"},
  97. sidelen = 16,
  98. noise_params = {
  99. offset = 0,
  100. scale = farming.blueberry,
  101. spread = {x = 100, y = 100, z = 100},
  102. seed = 678,
  103. octaves = 3,
  104. persist = 0.6
  105. },
  106. y_min = 3,
  107. y_max = 15,
  108. decoration = "farming:blueberry_4"
  109. })