corn.lua 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. --[[
  2. Original textures from GeMinecraft
  3. http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/1440575-1-2-5-generation-minecraft-beta-1-2-farming-and
  4. ]]
  5. local S = farming.translate
  6. -- corn
  7. minetest.register_craftitem("farming:corn", {
  8. description = S("Corn"),
  9. inventory_image = "farming_corn.png",
  10. groups = {compostability = 45, seed = 2, food_corn = 1, flammable = 2},
  11. on_place = function(itemstack, placer, pointed_thing)
  12. return farming.place_seed(itemstack, placer, pointed_thing, "farming:corn_1")
  13. end,
  14. on_use = minetest.item_eat(3)
  15. })
  16. -- corn on the cob (texture by TenPlus1)
  17. minetest.register_craftitem("farming:corn_cob", {
  18. description = S("Corn on the Cob"),
  19. inventory_image = "farming_corn_cob.png",
  20. groups = {compostability = 65, food_corn_cooked = 1, flammable = 2},
  21. on_use = minetest.item_eat(5)
  22. })
  23. minetest.register_craft({
  24. type = "cooking",
  25. cooktime = 10,
  26. output = "farming:corn_cob",
  27. recipe = "group:food_corn"
  28. })
  29. -- popcorn
  30. minetest.register_craftitem("farming:popcorn", {
  31. description = S("Popcorn"),
  32. inventory_image = "farming_popcorn.png",
  33. groups = {compostability = 55, food_popcorn = 1, flammable = 2},
  34. on_use = minetest.item_eat(4)
  35. })
  36. local tmp = farming.use_utensils and "farming:pot" or ""
  37. minetest.register_craft({
  38. output = "farming:popcorn",
  39. recipe = {
  40. {"group:food_oil", "group:food_corn", tmp}
  41. },
  42. replacements = {
  43. {"group:food_pot", "farming:pot"},
  44. {"group:food_oil", "vessels:glass_bottle"}
  45. }
  46. })
  47. -- cornstarch
  48. minetest.register_craftitem("farming:cornstarch", {
  49. description = S("Cornstarch"),
  50. inventory_image = "farming_cornstarch.png",
  51. groups = {compostability = 65, food_cornstarch = 1, food_gelatin = 1, flammable = 2}
  52. })
  53. tmp = farming.use_utensils and "farming:mortar_pestle" or ""
  54. local tmp2 = farming.use_utensils and "farming:baking_tray" or ""
  55. minetest.register_craft({
  56. output = "farming:cornstarch",
  57. recipe = {
  58. {tmp, "group:food_corn_cooked", tmp2},
  59. {"", "group:food_bowl", ""},
  60. },
  61. replacements = {
  62. {"group:food_mortar_pestle", "farming:mortar_pestle"},
  63. {"group:food_baking_tray", "farming:baking_tray"}
  64. }
  65. })
  66. -- ethanol (thanks to JKMurray for this idea)
  67. minetest.register_node("farming:bottle_ethanol", {
  68. description = S("Bottle of Ethanol"),
  69. drawtype = "plantlike",
  70. tiles = {"farming_bottle_ethanol.png"},
  71. inventory_image = "farming_bottle_ethanol.png",
  72. wield_image = "farming_bottle_ethanol.png",
  73. paramtype = "light",
  74. is_ground_content = false,
  75. walkable = false,
  76. selection_box = {
  77. type = "fixed",
  78. fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
  79. },
  80. groups = {vessel = 1, dig_immediate = 3, attached_node = 1, compostability = 55},
  81. sounds = farming.sounds.node_sound_glass_defaults()
  82. })
  83. minetest.register_craft( {
  84. output = "farming:bottle_ethanol",
  85. recipe = {
  86. {"group:food_corn", "group:food_corn", "group:food_corn"},
  87. {"group:food_corn", "vessels:glass_bottle", "group:food_corn"},
  88. {"group:food_corn", "group:food_corn", "group:food_corn"}
  89. }
  90. })
  91. minetest.register_craft({
  92. type = "fuel",
  93. recipe = "farming:bottle_ethanol",
  94. burntime = 80,
  95. replacements = {{"farming:bottle_ethanol", "vessels:glass_bottle"}}
  96. })
  97. -- corn definition
  98. local def = {
  99. drawtype = "plantlike",
  100. tiles = {"farming_corn_1.png"},
  101. paramtype = "light",
  102. sunlight_propagates = true,
  103. walkable = false,
  104. buildable_to = true,
  105. drop = "",
  106. waving = 1,
  107. selection_box = farming.select,
  108. groups = {
  109. handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  110. not_in_creative_inventory = 1, growing = 1
  111. },
  112. sounds = farming.sounds.node_sound_leaves_defaults()
  113. }
  114. -- stage 1
  115. minetest.register_node("farming:corn_1", table.copy(def))
  116. -- stage 2
  117. def.tiles = {"farming_corn_2.png"}
  118. minetest.register_node("farming:corn_2", table.copy(def))
  119. -- stage 3
  120. def.tiles = {"farming_corn_3.png"}
  121. minetest.register_node("farming:corn_3", table.copy(def))
  122. -- stage 4
  123. def.tiles = {"farming_corn_4.png"}
  124. minetest.register_node("farming:corn_4", table.copy(def))
  125. -- stage 5
  126. def.tiles = {"farming_corn_5.png"}
  127. minetest.register_node("farming:corn_5", table.copy(def))
  128. -- stage 6
  129. def.tiles = {"farming_corn_6.png"}
  130. def.visual_scale = 1.9
  131. minetest.register_node("farming:corn_6", table.copy(def))
  132. -- stage 7
  133. def.tiles = {"farming_corn_7.png"}
  134. def.drop = {
  135. items = {
  136. {items = {"farming:corn"}, rarity = 1},
  137. {items = {"farming:corn"}, rarity = 2},
  138. {items = {"farming:corn"}, rarity = 3}
  139. }
  140. }
  141. minetest.register_node("farming:corn_7", table.copy(def))
  142. -- stage 8 (final)
  143. def.tiles = {"farming_corn_8.png"}
  144. def.groups.growing = nil
  145. def.selection_box = farming.select_final
  146. def.drop = {
  147. items = {
  148. {items = {"farming:corn 2"}, rarity = 1},
  149. {items = {"farming:corn 2"}, rarity = 2},
  150. {items = {"farming:corn 2"}, rarity = 2}
  151. }
  152. }
  153. minetest.register_node("farming:corn_8", table.copy(def))
  154. -- add to registered_plants
  155. farming.registered_plants["farming:corn"] = {
  156. crop = "farming:corn",
  157. seed = "farming:corn",
  158. minlight = farming.min_light,
  159. maxlight = farming.max_light,
  160. steps = 8
  161. }
  162. -- mapgen
  163. minetest.register_decoration({
  164. deco_type = "simple",
  165. place_on = {"mcl_core:dirt_with_grass, default:dirt_with_grass"},
  166. sidelen = 16,
  167. noise_params = {
  168. offset = 0,
  169. scale = farming.corn,
  170. spread = {x = 100, y = 100, z = 100},
  171. seed = 134,
  172. octaves = 3,
  173. persist = 0.6
  174. },
  175. y_min = 12,
  176. y_max = 25,
  177. decoration = "farming:corn_7"
  178. })