Merge branch 'mcl_explosions'
[MineClone/MineClone2.git] / mods / ITEMS / mcl_farming / wheat.lua
blob9a8a9f65eb3f5932ee714c9213f86281cbe6353a
1 local S = minetest.get_translator("mcl_farming")
3 minetest.register_craftitem("mcl_farming:wheat_seeds", {
4 -- Original Minecraft name: “Seeds”
5 description = S("Wheat Seeds"),
6 _tt_help = S("Grows on farmland"),
7 _doc_items_longdesc = S("Grows into a wheat plant. Chickens like wheat seeds."),
8 _doc_items_usagehelp = S("Place the wheat seeds on farmland (which can be created with a hoe) to plant a wheat plant. They grow in sunlight and grow faster on hydrated farmland. Rightclick an animal to feed it wheat seeds."),
9 groups = { craftitem=1 },
10 inventory_image = "mcl_farming_wheat_seeds.png",
11 on_place = function(itemstack, placer, pointed_thing)
12 return mcl_farming:place_seed(itemstack, placer, pointed_thing, "mcl_farming:wheat_1")
13 end
16 local sel_heights = {
17 -5/16,
18 -2/16,
20 3/16,
21 5/16,
22 6/16,
23 7/16,
26 for i=1,7 do
27 local create, name, longdesc
28 if i == 1 then
29 create = true
30 name = S("Premature Wheat Plant")
31 longdesc = S("Premature wheat plants grow on farmland under sunlight in 8 stages. On hydrated farmland, they grow faster. They can be harvested at any time but will only yield a profit when mature.")
32 else
33 create = false
34 end
36 minetest.register_node("mcl_farming:wheat_"..i, {
37 description = S("Premature Wheat Plant (Stage @1)", i),
38 _doc_items_create_entry = create,
39 _doc_items_entry_name = name,
40 _doc_items_longdesc = longdesc,
41 paramtype = "light",
42 paramtype2 = "meshoptions",
43 place_param2 = 3,
44 sunlight_propagates = true,
45 walkable = false,
46 drawtype = "plantlike",
47 drop = "mcl_farming:wheat_seeds",
48 tiles = {"mcl_farming_wheat_stage_"..(i-1)..".png"},
49 inventory_image = "mcl_farming_wheat_stage_"..(i-1)..".png",
50 wield_image = "mcl_farming_wheat_stage_"..(i-1)..".png",
51 selection_box = {
52 type = "fixed",
53 fixed = {
54 {-0.5, -0.5, -0.5, 0.5, sel_heights[i], 0.5}
57 groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1},
58 sounds = mcl_sounds.node_sound_leaves_defaults(),
59 _mcl_blast_resistance = 0,
61 end
63 minetest.register_node("mcl_farming:wheat", {
64 description = S("Mature Wheat Plant"),
65 _doc_items_longdesc = S("Mature wheat plants are ready to be harvested for wheat and wheat seeds. They won't grow any further."),
66 sunlight_propagates = true,
67 paramtype = "light",
68 paramtype2 = "meshoptions",
69 place_param2 = 3,
70 walkable = false,
71 drawtype = "plantlike",
72 tiles = {"mcl_farming_wheat_stage_7.png"},
73 inventory_image = "mcl_farming_wheat_stage_7.png",
74 wield_image = "mcl_farming_wheat_stage_7.png",
75 drop = {
76 max_items = 4,
77 items = {
78 { items = {'mcl_farming:wheat_seeds'} },
79 { items = {'mcl_farming:wheat_seeds'}, rarity = 2},
80 { items = {'mcl_farming:wheat_seeds'}, rarity = 5},
81 { items = {'mcl_farming:wheat_item'} }
84 groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1},
85 sounds = mcl_sounds.node_sound_leaves_defaults(),
86 _mcl_blast_resistance = 0,
89 mcl_farming:add_plant("plant_wheat", "mcl_farming:wheat", {"mcl_farming:wheat_1", "mcl_farming:wheat_2", "mcl_farming:wheat_3", "mcl_farming:wheat_4", "mcl_farming:wheat_5", "mcl_farming:wheat_6", "mcl_farming:wheat_7"}, 25, 20)
91 minetest.register_craftitem("mcl_farming:wheat_item", {
92 description = S("Wheat"),
93 _doc_items_longdesc = S("Wheat is used in crafting. Some animals like wheat."),
94 _doc_items_usagehelp = S("Use the “Place” key on an animal to try to feed it wheat."),
95 inventory_image = "farming_wheat_harvested.png",
96 groups = { craftitem = 1 },
99 minetest.register_craft({
100 output = "mcl_farming:bread",
101 recipe = {
102 {'mcl_farming:wheat_item', 'mcl_farming:wheat_item', 'mcl_farming:wheat_item'},
106 minetest.register_craft({
107 output = "mcl_farming:cookie 8",
108 recipe = {
109 {'mcl_farming:wheat_item', 'mcl_dye:brown', 'mcl_farming:wheat_item'},
113 minetest.register_craftitem("mcl_farming:cookie", {
114 description = S("Cookie"),
115 _doc_items_longdesc = S("This is a food item which can be eaten."),
116 inventory_image = "farming_cookie.png",
117 groups = {food=2, eatable=2},
118 _mcl_saturation = 0.4,
119 on_place = minetest.item_eat(2),
120 on_secondary_use = minetest.item_eat(2),
124 minetest.register_craftitem("mcl_farming:bread", {
125 description = S("Bread"),
126 _doc_items_longdesc = S("This is a food item which can be eaten."),
127 inventory_image = "farming_bread.png",
128 groups = {food=2, eatable=5},
129 _mcl_saturation = 6.0,
130 on_place = minetest.item_eat(5),
131 on_secondary_use = minetest.item_eat(5),
134 local mod_screwdriver = minetest.get_modpath("screwdriver") ~= nil
135 local on_rotate
136 if mod_screwdriver then
137 on_rotate = screwdriver.rotate_3way
140 minetest.register_node("mcl_farming:hay_block", {
141 description = S("Hay Bale"),
142 _doc_items_longdesc = S("Hay bales are decorative blocks made from wheat."),
143 tiles = {"mcl_farming_hayblock_top.png", "mcl_farming_hayblock_top.png", "mcl_farming_hayblock_side.png"},
144 is_ground_content = false,
145 stack_max = 64,
146 paramtype2 = "facedir",
147 is_ground_content = false,
148 on_place = mcl_util.rotate_axis,
149 groups = {handy=1, flammable=2, fire_encouragement=60, fire_flammability=20, building_block=1, fall_damage_add_percent=-80},
150 sounds = mcl_sounds.node_sound_leaves_defaults(),
151 on_rotate = on_rotate,
152 _mcl_blast_resistance = 0.5,
153 _mcl_hardness = 0.5,
156 minetest.register_craft({
157 output = 'mcl_farming:hay_block',
158 recipe = {
159 {'mcl_farming:wheat_item', 'mcl_farming:wheat_item', 'mcl_farming:wheat_item'},
160 {'mcl_farming:wheat_item', 'mcl_farming:wheat_item', 'mcl_farming:wheat_item'},
161 {'mcl_farming:wheat_item', 'mcl_farming:wheat_item', 'mcl_farming:wheat_item'},
165 minetest.register_craft({
166 output = 'mcl_farming:wheat_item 9',
167 recipe = {
168 {'mcl_farming:hay_block'},
172 if minetest.get_modpath("doc") then
173 for i=2,7 do
174 doc.add_entry_alias("nodes", "mcl_farming:wheat_1", "nodes", "mcl_farming:wheat_"..i)