2021-05-29 17:12:33 +03:00
local S = minetest.get_translator ( minetest.get_current_modname ( ) )
local table = table
2019-03-15 10:50:32 +02:00
2017-02-10 05:15:14 +02:00
minetest.register_node ( " mcl_nether:nether_wart_0 " , {
2019-03-15 10:50:32 +02:00
description = S ( " Premature Nether Wart (Stage 1) " ) ,
_doc_items_longdesc = S ( " A premature nether wart has just recently been planted on soul sand. Nether wart slowly grows on soul sand in 4 stages (the second and third stages look identical). Although nether wart is home to the Nether, it grows in any dimension. " ) ,
2017-02-10 05:15:14 +02:00
paramtype = " light " ,
2017-03-14 22:45:21 +02:00
paramtype2 = " meshoptions " ,
place_param2 = 3 ,
2017-02-10 05:15:14 +02:00
walkable = false ,
drawtype = " plantlike " ,
drop = " mcl_nether:nether_wart_item " ,
tiles = { " mcl_nether_nether_wart_stage_0.png " } ,
2018-10-24 19:16:39 +03:00
wield_image = " mcl_nether_nether_wart_stage_0.png " ,
inventory_image = " mcl_nether_nether_wart_stage_0.png " ,
2017-02-10 05:15:14 +02:00
selection_box = {
type = " fixed " ,
fixed = {
{ - 0.5 , - 0.5 , - 0.5 , 0.5 , - 0.125 , 0.5 }
} ,
} ,
2017-05-22 23:29:15 +03:00
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 } ,
2017-02-11 19:46:23 +02:00
sounds = mcl_sounds.node_sound_leaves_defaults ( ) ,
2017-02-10 05:15:14 +02:00
} )
minetest.register_node ( " mcl_nether:nether_wart_1 " , {
2019-03-15 10:50:32 +02:00
description = S ( " Premature Nether Wart (Stage 2) " ) ,
2017-03-14 22:45:21 +02:00
_doc_items_create_entry = false ,
2017-02-10 05:15:14 +02:00
paramtype = " light " ,
2017-03-14 22:45:21 +02:00
paramtype2 = " meshoptions " ,
place_param2 = 3 ,
2017-02-10 05:15:14 +02:00
walkable = false ,
drawtype = " plantlike " ,
drop = " mcl_nether:nether_wart_item " ,
tiles = { " mcl_nether_nether_wart_stage_1.png " } ,
2018-10-24 19:16:39 +03:00
wield_image = " mcl_nether_nether_wart_stage_1.png " ,
inventory_image = " mcl_nether_nether_wart_stage_1.png " ,
2017-02-10 05:15:14 +02:00
selection_box = {
type = " fixed " ,
fixed = {
{ - 0.5 , - 0.5 , - 0.5 , 0.5 , 0.15 , 0.5 }
} ,
} ,
2017-05-22 23:29:15 +03:00
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 } ,
2017-02-11 19:46:23 +02:00
sounds = mcl_sounds.node_sound_leaves_defaults ( ) ,
2017-02-10 05:15:14 +02:00
} )
minetest.register_node ( " mcl_nether:nether_wart_2 " , {
2019-03-15 10:50:32 +02:00
description = S ( " Premature Nether Wart (Stage 3) " ) ,
2017-03-11 20:26:32 +02:00
_doc_items_create_entry = false ,
2017-02-10 05:15:14 +02:00
paramtype = " light " ,
2017-03-14 22:45:21 +02:00
paramtype2 = " meshoptions " ,
place_param2 = 3 ,
2017-02-10 05:15:14 +02:00
walkable = false ,
drawtype = " plantlike " ,
drop = " mcl_nether:nether_wart_item " ,
tiles = { " mcl_nether_nether_wart_stage_1.png " } ,
2018-10-24 19:16:39 +03:00
wield_image = " mcl_nether_nether_wart_stage_1.png " ,
inventory_image = " mcl_nether_nether_wart_stage_1.png " ,
2017-02-10 05:15:14 +02:00
selection_box = {
type = " fixed " ,
fixed = {
{ - 0.5 , - 0.5 , - 0.5 , 0.5 , 0.15 , 0.5 }
} ,
} ,
2017-05-22 23:29:15 +03:00
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 } ,
2017-02-11 19:46:23 +02:00
sounds = mcl_sounds.node_sound_leaves_defaults ( ) ,
2017-02-10 05:15:14 +02:00
} )
minetest.register_node ( " mcl_nether:nether_wart " , {
2019-03-15 10:50:32 +02:00
description = S ( " Mature Nether Wart " ) ,
_doc_items_longdesc = S ( " The mature nether wart is a plant from the Nether and reached its full size and won't grow any further. It is ready to be harvested for its items. " ) ,
2017-02-10 05:15:14 +02:00
paramtype = " light " ,
2017-03-14 22:45:21 +02:00
paramtype2 = " meshoptions " ,
place_param2 = 3 ,
2017-02-10 05:15:14 +02:00
walkable = false ,
drawtype = " plantlike " ,
drop = {
max_items = 2 ,
items = {
{ items = { " mcl_nether:nether_wart_item 2 " } , rarity = 1 } ,
{ items = { " mcl_nether:nether_wart_item 2 " } , rarity = 3 } ,
{ items = { " mcl_nether:nether_wart_item 1 " } , rarity = 3 } ,
} ,
} ,
tiles = { " mcl_nether_nether_wart_stage_2.png " } ,
2018-10-24 19:16:39 +03:00
wield_image = " mcl_nether_nether_wart_stage_2.png " ,
inventory_image = " mcl_nether_nether_wart_stage_2.png " ,
2020-07-05 04:28:02 +03:00
selection_box = {
2017-02-10 05:15:14 +02:00
type = " fixed " ,
fixed = {
{ - 0.5 , - 0.5 , - 0.5 , 0.5 , 0.45 , 0.5 }
} ,
} ,
2017-05-22 23:29:15 +03:00
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 } ,
2017-02-11 19:46:23 +02:00
sounds = mcl_sounds.node_sound_leaves_defaults ( ) ,
2020-11-06 14:46:52 +02:00
_mcl_fortune_drop = {
discrete_uniform_distribution = true ,
items = { " mcl_nether:nether_wart_item " } ,
min_count = 2 ,
max_count = 4 ,
}
2017-02-10 05:15:14 +02:00
} )
minetest.register_craftitem ( " mcl_nether:nether_wart_item " , {
2019-03-15 10:50:32 +02:00
description = S ( " Nether Wart " ) ,
2020-02-19 05:54:17 +02:00
_tt_help = S ( " Grows on soul sand " ) ,
2019-03-15 10:50:32 +02:00
_doc_items_longdesc = S ( " Nether warts are plants home to the Nether. They can be planted on soul sand and grow in 4 stages. " ) ,
2019-03-25 13:05:57 +02:00
_doc_items_usagehelp = S ( " Place this item on soul sand to plant it and watch it grow. " ) ,
2017-02-10 05:15:14 +02:00
inventory_image = " mcl_nether_nether_wart.png " ,
wield_image = " mcl_nether_nether_wart.png " ,
Add `compostability` to node definition group.
* mcl_cake/init.lua (cake);
* mcl_core/craftitems.lua (apple);
* mcl_core/nodes_base.lua (dirt with grass);
* mcl_core/nodes_cactuscane.lua (cactus, sugarcane);
* mcl_core/nodes_climb.lua (vines);
* mcl_core/nodes_trees.lua (leaves, saplings);
* mcl_dye/init.lua (cocoa beans);
* mcl_farming/beetroot.lua (beetroot, & seeds);
* mcl_farming/carrots.lua (carrot);
* mcl_farming/melon.lua (melon, & slice, & seeds);
* mcl_farming/potatoes.lua (potato, baked potato);
* mcl_farming/pumpkin.lua (pumpkin, carved &, & seeds, & pie);
* mcl_farming/wheat.lua (wheat, cookie, bread, hay block);
* mcl_flowers/init.lua (flowers, ferns, grass, & tall variants);
* mcl_mushrooms/small.lua (red and brown mushrooms);
* mcl_mushrooms/huge.lua (red and brown huge mushrooms);
* mcl_nether/init.lua (nether wart block);
* mcl_nether/nether_wart.lua (nether wart);
* mcl_ocean/kelp.lua (kelp, dried &, & block);
* mcl_ocean/sea_pickle.lua (sea pickle);
* mcl_ocean/seagrass.lua (seagrass).
2022-03-29 13:54:51 +03:00
groups = { craftitem = 1 , brewitem = 1 , compostability = 30 } ,
2017-02-10 05:15:14 +02:00
on_place = function ( itemstack , placer , pointed_thing )
if pointed_thing.type ~= " node " then
return itemstack
end
2017-03-02 17:09:13 +02:00
-- Use pointed node's on_rightclick function first, if present
local node = minetest.get_node ( pointed_thing.under )
if placer and not placer : get_player_control ( ) . sneak then
if minetest.registered_nodes [ node.name ] and minetest.registered_nodes [ node.name ] . on_rightclick then
return minetest.registered_nodes [ node.name ] . on_rightclick ( pointed_thing.under , node , placer , itemstack ) or itemstack
end
end
2017-02-10 05:26:06 +02:00
local placepos = pointed_thing.above
local soilpos = table.copy ( placepos )
soilpos.y = soilpos.y - 1
2017-02-10 05:15:14 +02:00
-- Check for correct soil type
2017-02-10 05:26:06 +02:00
local chk = minetest.get_item_group ( minetest.get_node ( soilpos ) . name , " soil_nether_wart " )
2021-05-29 17:12:33 +03:00
if chk and chk ~= 0 then
2017-02-10 05:15:14 +02:00
-- Check if node above soil node allows placement
2017-02-10 05:26:06 +02:00
if minetest.registered_items [ minetest.get_node ( placepos ) . name ] . buildable_to then
2017-02-10 05:20:25 +02:00
-- Place nether wart
2020-04-07 01:55:45 +03:00
minetest.sound_play ( { name = " default_place_node " , gain = 1.0 } , { pos = placepos } , true )
2017-03-14 22:45:21 +02:00
minetest.set_node ( placepos , { name = " mcl_nether:nether_wart_0 " , param2 = 3 } )
2017-02-10 05:20:25 +02:00
2020-07-10 17:08:40 +03:00
if not minetest.is_creative_enabled ( placer : get_player_name ( ) ) then
2017-02-10 05:15:14 +02:00
itemstack : take_item ( )
end
return itemstack
end
end
end ,
} )
local names = { " mcl_nether:nether_wart_0 " , " mcl_nether:nether_wart_1 " , " mcl_nether:nether_wart_2 " }
minetest.register_abm ( {
2017-05-15 01:45:54 +03:00
label = " Nether wart growth " ,
2017-02-10 05:15:14 +02:00
nodenames = { " mcl_nether:nether_wart_0 " , " mcl_nether:nether_wart_1 " , " mcl_nether:nether_wart_2 " } ,
neighbors = { " group:soil_nether_wart " } ,
interval = 35 ,
chance = 11 ,
action = function ( pos , node )
pos.y = pos.y - 1
if minetest.get_item_group ( minetest.get_node ( pos ) . name , " soil_nether_wart " ) == 0 then
return
end
pos.y = pos.y + 1
local step = nil
for i , name in ipairs ( names ) do
if name == node.name then
step = i
break
end
end
if step == nil then
return
end
local new_node = { name = names [ step + 1 ] }
if new_node.name == nil then
new_node.name = " mcl_nether:nether_wart "
end
2017-03-14 22:45:21 +02:00
new_node.param = node.param
new_node.param2 = node.param2
minetest.set_node ( pos , new_node )
2017-02-10 05:15:14 +02:00
end
} )
2017-03-21 05:58:38 +02:00
if minetest.get_modpath ( " doc " ) then
for i = 1 , 2 do
doc.add_entry_alias ( " nodes " , " mcl_nether:nether_wart_0 " , " nodes " , " mcl_nether:nether_wart_ " .. i )
end
end