From 6efbb5f42ff502866956c82e9a371e85b85d3094 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 10 Feb 2017 04:15:14 +0100 Subject: [PATCH] Add nether wart --- mods/mcl_nether/init.lua | 15 +- mods/mcl_nether/nether_wart.lua | 130 ++++++++++++++++++ .../textures/mcl_nether_nether_wart.png | Bin 0 -> 270 bytes .../mcl_nether_nether_wart_stage_0.png | Bin 0 -> 254 bytes .../mcl_nether_nether_wart_stage_1.png | Bin 0 -> 554 bytes .../mcl_nether_nether_wart_stage_2.png | Bin 0 -> 971 bytes 6 files changed, 138 insertions(+), 7 deletions(-) create mode 100644 mods/mcl_nether/nether_wart.lua create mode 100644 mods/mcl_nether/textures/mcl_nether_nether_wart.png create mode 100644 mods/mcl_nether/textures/mcl_nether_nether_wart_stage_0.png create mode 100644 mods/mcl_nether/textures/mcl_nether_nether_wart_stage_1.png create mode 100644 mods/mcl_nether/textures/mcl_nether_nether_wart_stage_2.png diff --git a/mods/mcl_nether/init.lua b/mods/mcl_nether/init.lua index 3fbe77837..8ed09a589 100644 --- a/mods/mcl_nether/init.lua +++ b/mods/mcl_nether/init.lua @@ -217,24 +217,25 @@ minetest.register_craft({ minetest.register_craft({ output = "mcl_nether:red_nether_brick", recipe = { - {'mcl_nether:nether_wart', 'mcl_nether:netherbrick'}, - {'mcl_nether:netherbrick', 'mcl_nether:nether_wart'}, + {'mcl_nether:nether_wart_item', 'mcl_nether:netherbrick'}, + {'mcl_nether:netherbrick', 'mcl_nether:nether_wart_item'}, } }) minetest.register_craft({ output = "mcl_nether:red_nether_brick", recipe = { - {'mcl_nether:netherbrick', 'mcl_nether:nether_wart'}, - {'mcl_nether:nether_wart', 'mcl_nether:netherbrick'}, + {'mcl_nether:netherbrick', 'mcl_nether:nether_wart_item'}, + {'mcl_nether:nether_wart_item', 'mcl_nether:netherbrick'}, } }) minetest.register_craft({ output = "mcl_nether:nether_wart_block", recipe = { - {'mcl_nether:nether_wart', 'mcl_nether:nether_wart', 'mcl_nether:nether_wart'}, - {'mcl_nether:nether_wart', 'mcl_nether:nether_wart', 'mcl_nether:nether_wart'}, - {'mcl_nether:nether_wart', 'mcl_nether:nether_wart', 'mcl_nether:nether_wart'}, + {'mcl_nether:nether_wart_item', 'mcl_nether:nether_wart_item', 'mcl_nether:nether_wart_item'}, + {'mcl_nether:nether_wart_item', 'mcl_nether:nether_wart_item', 'mcl_nether:nether_wart_item'}, + {'mcl_nether:nether_wart_item', 'mcl_nether:nether_wart_item', 'mcl_nether:nether_wart_item'}, } }) +dofile(minetest.get_modpath(minetest.get_current_modname()).."/nether_wart.lua") diff --git a/mods/mcl_nether/nether_wart.lua b/mods/mcl_nether/nether_wart.lua new file mode 100644 index 000000000..63bfed343 --- /dev/null +++ b/mods/mcl_nether/nether_wart.lua @@ -0,0 +1,130 @@ +minetest.register_node("mcl_nether:nether_wart_0", { + paramtype = "light", + walkable = false, + buildable_to = true, + drawtype = "plantlike", + drop = "mcl_nether:nether_wart_item", + tiles = {"mcl_nether_nether_wart_stage_0.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.125, 0.5} + }, + }, + groups = {dig_immediate=3, not_in_creative_inventory=1,attached_node=1,dig_by_water=1}, + sounds = mcl_core.node_sound_leaves_defaults(), +}) + +minetest.register_node("mcl_nether:nether_wart_1", { + paramtype = "light", + walkable = false, + buildable_to = true, + drawtype = "plantlike", + drop = "mcl_nether:nether_wart_item", + tiles = {"mcl_nether_nether_wart_stage_1.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0.15, 0.5} + }, + }, + groups = {dig_immediate=3, not_in_creative_inventory=1,attached_node=1,dig_by_water=1}, + sounds = mcl_core.node_sound_leaves_defaults(), +}) + +minetest.register_node("mcl_nether:nether_wart_2", { + paramtype = "light", + walkable = false, + buildable_to = true, + drawtype = "plantlike", + drop = "mcl_nether:nether_wart_item", + tiles = {"mcl_nether_nether_wart_stage_1.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0.15, 0.5} + }, + }, + groups = {dig_immediate=3, not_in_creative_inventory=1,attached_node=1,dig_by_water=1}, + sounds = mcl_core.node_sound_leaves_defaults(), +}) + +minetest.register_node("mcl_nether:nether_wart", { + paramtype = "light", + walkable = false, + buildable_to = true, + 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"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0.45, 0.5} + }, + }, + groups = {dig_immediate=3, not_in_creative_inventory=1,attached_node=1,dig_by_water=1}, + sounds = mcl_core.node_sound_leaves_defaults(), +}) + +minetest.register_craftitem("mcl_nether:nether_wart_item", { + description = "Nether Wart", + inventory_image = "mcl_nether_nether_wart.png", + wield_image = "mcl_nether_nether_wart.png", + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" then + return itemstack + end + -- Check for correct soil type + local chk = minetest.get_item_group(minetest.get_node(pointed_thing.under).name, "soil_nether_wart") + if chk ~= 0 and chk ~= nil then + -- Check if node above soil node allows placement + if minetest.registered_items[minetest.get_node(pointed_thing.above).name].buildable_to then + minetest.set_node(pointed_thing.above, {name="mcl_nether:nether_wart_0"}) + if not minetest.setting_get("creative_mode") then + itemstack:take_item() + end + return itemstack + end + end + end, + groups = { craftitem = 1 }, +}) + +local names = {"mcl_nether:nether_wart_0", "mcl_nether:nether_wart_1", "mcl_nether:nether_wart_2"} + +minetest.register_abm({ + 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 + minetest.swap_node(pos, new_node) + end +}) + diff --git a/mods/mcl_nether/textures/mcl_nether_nether_wart.png b/mods/mcl_nether/textures/mcl_nether_nether_wart.png new file mode 100644 index 0000000000000000000000000000000000000000..be0a6a98580539d40d830f6745437dbcd1cd99fb GIT binary patch literal 270 zcmV+p0rCEcP) zyA8uI3`Dg;invIhJ{!1q;R!Nd#>i?6t`Kmb6@4N~fdLi-3>ALQJeqb8k?_w7F5m(# za4LcKx(Vuae@HyTHR^f2$xs1?YXQK2m1q)(@cptJ1aQXZ<^tSm1~Gi706+}WLJ^*d z$!rMuNjY~N2?`=LGtrzsKXEF1hMNfR^v9d#a%XtWOjNa<;oN?`7gB;I5$Nnu-#XL! zN;VB4-#iDOwg-CQU3;LkpoV;ma_}hv3{AnO3Y7N2FaaxY*B?<&%l)6w1zbSa2kQeK U^&1r^ivR!s07*qoM6N<$f^{ovE&u=k literal 0 HcmV?d00001 diff --git a/mods/mcl_nether/textures/mcl_nether_nether_wart_stage_0.png b/mods/mcl_nether/textures/mcl_nether_nether_wart_stage_0.png new file mode 100644 index 0000000000000000000000000000000000000000..7a73f345eaece6e66e2c9211333df09949ff2391 GIT binary patch literal 254 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJqn<8~ArXg@fBgS%f7l_ZEs(v( zD&Y#_Vm^t|11p%_WDQ<51hVs3vp?a|_;pLCV(`2vu;d`4Mr)pc2haROg*V3zwJ+pXaVxTH zIL+8{ifNY>gNW3Nw#lywHpwz=#nM-Fu0)R?Hj7!`qt0TU;hIPypQ7r*VuzH*w=%WbJm z)Wk5@=}p^x*6PzDBI_?>Ed&+<3xS2ezZG~XxD=Hi6#(FUXD>2?RDp~Fan0kxKX#A& zm?RRL#}SBvzgfAUfL=^0!E>VEud8;rKv+pPk1L>q8J+lPAd3tlMG zIFqGeI<1PAC5NKm{G-Agoa_JE0ha>jZbd~F!vy%aNdQ+rBj8`rWQigB8#x8XUAS&-QK#vuB65(;_(iPw7IWlr s%;Ek0TAi-knsJW*8A<_u2Yy4~6GNj;NiQBuZU6uP07*qoM6N<$f(U%{2mk;8 literal 0 HcmV?d00001 diff --git a/mods/mcl_nether/textures/mcl_nether_nether_wart_stage_2.png b/mods/mcl_nether/textures/mcl_nether_nether_wart_stage_2.png new file mode 100644 index 0000000000000000000000000000000000000000..384f5fc1a3dc411e8ce804e341c738ba41aa7cfc GIT binary patch literal 971 zcmV;+12p`JP)*K@(JJz)~wEW}zaATvLNli6PM!jUT~} z;0N%C{2%EW6(9ijsT#X={jKw%P-ZA)7#IT7r!ub&krA_2`Ic6^! zv7Yhw4;?-$-UjeJH))NsIqIaX!;%QFEdZ$2Bf!V57#Epa05ZMGTr?(g+CXJ4uWcEi znKA0rb;%Jx1&hWQhe80`5mcL$?{5JJf&lQDAZ!3XCa0C=-^Q+T(FUyoe4U%I44sb9 z27r(mi}cH3Sfw5a;`~yZfcvtps?> zbSzau1+brp!ba>2q+ta_a~YuO_P~zjh0VSgZ=!W3z*4psZnI<>{tcA? z6Ims|Za{-_(r5^P=BUEhZvd1dz+A`=rA{y0VJ2w4cRj}e)<)7C0JXqO4}yN!iiS7< zzTKlC@|CIkrXTqCpo|@1G*3ZobL=IEdU$|f&ftG0|;sy07o=O ztq&%k#5OOmMnc^%0~D}@y7ty^fLe)*N6MKN(^F^L6E^zB*4pz^9QLI2f+38I|`o(;QrJw++*{_ tu?*KZyHhR%pxA4005X&Ts0UgB_yvg#i*vc2H=+Ol002ovPDHLkV1fr~uL%GE literal 0 HcmV?d00001