blackberry.lua 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. local S = farming.translate
  2. -- blackberries
  3. minetest.register_craftitem("farming:blackberry", {
  4. description = S("Blackberries"),
  5. inventory_image = "farming_blackberry.png",
  6. groups = {
  7. compostability = 48, seed = 2, food_blackberries = 1, food_blackberry = 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:blackberry_1")
  12. end,
  13. on_use = minetest.item_eat(1)
  14. })
  15. local def = {
  16. drawtype = "plantlike",
  17. tiles = {"farming_blackberry_1.png"},
  18. paramtype = "light",
  19. sunlight_propagates = true,
  20. walkable = false,
  21. buildable_to = true,
  22. drop = "",
  23. selection_box = farming.select,
  24. groups = {
  25. handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  26. not_in_creative_inventory = 1, growing = 1
  27. },
  28. sounds = farming.sounds.node_sound_leaves_defaults()
  29. }
  30. -- stage 1
  31. minetest.register_node("farming:blackberry_1", table.copy(def))
  32. -- stage 2
  33. def.tiles = {"farming_blackberry_2.png"}
  34. minetest.register_node("farming:blackberry_2", table.copy(def))
  35. -- stage 3
  36. def.tiles = {"farming_blackberry_3.png"}
  37. minetest.register_node("farming:blackberry_3", table.copy(def))
  38. -- stage 4
  39. def.tiles = {"farming_blackberry_4.png"}
  40. def.groups.growing = nil
  41. def.selection_box = farming.select_final
  42. def.drop = {
  43. items = {
  44. {items = {'farming:blackberry 2'}, rarity = 1},
  45. {items = {'farming:blackberry'}, rarity = 2},
  46. {items = {'farming:blackberry'}, rarity = 3},
  47. }
  48. }
  49. minetest.register_node("farming:blackberry_4", table.copy(def))
  50. -- add to registered_plants
  51. farming.registered_plants["farming:blackberry"] = {
  52. crop = "farming:blackberry",
  53. seed = "farming:blackberry",
  54. minlight = farming.min_light,
  55. maxlight = farming.max_light,
  56. steps = 4
  57. }
  58. -- mapgen
  59. minetest.register_decoration({
  60. deco_type = "simple",
  61. place_on = {"mcl_core:dirt_with_grass, default:dirt_with_grass"},
  62. sidelen = 16,
  63. noise_params = {
  64. offset = 0,
  65. scale = farming.blackberry,
  66. spread = {x = 100, y = 100, z = 100},
  67. seed = 567,
  68. octaves = 3,
  69. persist = 0.6
  70. },
  71. y_min = 3,
  72. y_max = 20,
  73. decoration = "farming:blackberry_4"
  74. })