From 7464b8ff48ddf3b71743513ffbf8781520ed5850 Mon Sep 17 00:00:00 2001 From: NO11 Date: Thu, 3 Jun 2021 18:04:54 +0000 Subject: [PATCH 1/2] Add bonemeal particle texture --- .../textures/mcl_particles_bonemeal.png | Bin 0 -> 3356 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 mods/CORE/mcl_particles/textures/mcl_particles_bonemeal.png diff --git a/mods/CORE/mcl_particles/textures/mcl_particles_bonemeal.png b/mods/CORE/mcl_particles/textures/mcl_particles_bonemeal.png new file mode 100644 index 0000000000000000000000000000000000000000..684df986508ce902058e048ee22b61d9fac58223 GIT binary patch literal 3356 zcmV+%4de2OP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+P#@;awH+Hh5xgPSwaHhwH%%ivxB?*`2<;hb=hrq zcU)K4S(PRM=}1RMl$rnc-(~*8k2nz{A>~+Ny!eqK#Z}(q>-?Ony=4DAKjpsK_xH`q zKODC_SARand5^E$53dg-x$n34_f6{eJo%pJvGP5k*OeV_?s55^$h&jj-k;55Lsj0G zbN{aH_P;|r|N8h@63!Tb`Mfi3dh0L#W?jYWul1E{+<#e^&t<>A`0Kqq_nmop`@wlH z?>_kMs`q{W-WBGG_kj4pNB4ajp8IZl=&ox`k;b*Iw?A)vw?Ebz_Tlczao~!&bZO+}Cb9TNF24;_6%n z1HG4ha>aG85Qx6)atSbo@fn;tsDX!fFMF|j-Llu~HnZ}ujC7XCEKmIMGS6=Q$?IjJ zwKR0Cz4D8%*q76oW*dr}{$&(^*me6fZ2#_;c@sC+8(=*MhVABzf%R%=x#U`0@laSOu_RM+DWz5xtxR2cx-z2H=9+KPLW?c6+)AsR@afV+ zk3IF=ORvKXKS=)(M=~RiGU~LGP?|Esj5EzV%dCr7TYkw3E3UNiDyzPrcBA?pHTwa% zuTir%YKoZbap@H`Zm0B^!YZ8v#SFxpSP)N&00He3vnyK>r^qR0S8*goaG+*`f-|fl z27)rJ3(LM>_ln$?xS1e7!p(h#oKfih1#(8Ay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-;IHL7IFXb1;QZ~J+!4uY3G}PE&R7z%|0#oblCXL>};Lz|LLQDJ`p)nh@bxf+A`4oGf$DO00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmYE+YT{E+YYWr9XB6000McNliru Date: Thu, 3 Jun 2021 18:13:13 +0000 Subject: [PATCH 2/2] Add code for bonemeal particles --- mods/ITEMS/mcl_dye/init.lua | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_dye/init.lua b/mods/ITEMS/mcl_dye/init.lua index 6771a95e5..11e5d08f4 100644 --- a/mods/ITEMS/mcl_dye/init.lua +++ b/mods/ITEMS/mcl_dye/init.lua @@ -128,6 +128,24 @@ for _, row in ipairs(dyelocal.dyes) do end -- Bone Meal +local function bone_meal_particle(pos) + minetest.add_particlespawner({ + amount = 10, + time = 0.1, + minpos = { x = pos.x - 0.5, y = pos.y - 0.5, z = pos.z - 0.5 }, + maxpos = { x = pos.x + 0.5, y = pos.y + 0.5, z = pos.z + 0.5 }, + minvel = { x = 0, y = 0, z = 0}, + maxvel = { x = 0, y = 0, z = 0}, + minacc = { x = 0, y = 0, z = 0}, + maxacc = { x = 0, y = 0, z = 0}, + minexptime = 1, + maxexptime = 4, + minsize = 0.7, + maxsize = 2.4, + texture = "mcl_particles_bonemeal.png^[colorize:#00EE00:125", -- TODO: real MC color + glow = 5, + }) +end function mcl_dye.apply_bone_meal(pointed_thing) -- Bone meal currently spawns all flowers found in the plains. @@ -166,11 +184,13 @@ function mcl_dye.apply_bone_meal(pointed_thing) local n = minetest.get_node(pos) if n.name == "" then return false end if minetest.get_item_group(n.name, "sapling") >= 1 then + bone_meal_particle(pos) -- Saplings: 45% chance to advance growth stage if math.random(1,100) <= 45 then return mcl_core.grow_sapling(pos, n) end elseif minetest.get_item_group(n.name, "mushroom") == 1 then + bone_meal_particle(pos) -- Try to grow huge mushroom -- Must be on a dirt-type block @@ -193,7 +213,7 @@ function mcl_dye.apply_bone_meal(pointed_thing) return false end -- 40% chance - if math.random(1,100) <= 40 then + if math.random(1, 100) <= 40 then -- Check space requirements for i=1,3 do local cpos = vector.add(pos, {x=0, y=i, z=0}) @@ -220,30 +240,39 @@ function mcl_dye.apply_bone_meal(pointed_thing) return false -- Wheat, Potato, Carrot, Pumpkin Stem, Melon Stem: Advance by 2-5 stages elseif string.find(n.name, "mcl_farming:wheat_") then + bone_meal_particle(pos) local stages = math.random(2, 5) return mcl_farming:grow_plant("plant_wheat", pos, n, stages, true) elseif string.find(n.name, "mcl_farming:potato_") then + bone_meal_particle(pos) local stages = math.random(2, 5) return mcl_farming:grow_plant("plant_potato", pos, n, stages, true) elseif string.find(n.name, "mcl_farming:carrot_") then + bone_meal_particle(pos) local stages = math.random(2, 5) return mcl_farming:grow_plant("plant_carrot", pos, n, stages, true) elseif string.find(n.name, "mcl_farming:pumpkin_") then + bone_meal_particle(pos) local stages = math.random(2, 5) return mcl_farming:grow_plant("plant_pumpkin_stem", pos, n, stages, true) elseif string.find(n.name, "mcl_farming:melontige_") then + bone_meal_particle(pos) local stages = math.random(2, 5) return mcl_farming:grow_plant("plant_melon_stem", pos, n, stages, true) elseif string.find(n.name, "mcl_farming:beetroot_") then + bone_meal_particle(pos) -- Beetroot: 75% chance to advance to next stage if math.random(1, 100) <= 75 then return mcl_farming:grow_plant("plant_beetroot", pos, n, 1, true) end elseif n.name == "mcl_cocoas:cocoa_1" or n.name == "mcl_cocoas:cocoa_2" then + bone_meal_particle(pos) -- Cocoa: Advance by 1 stage mcl_cocoas.grow(pos) return true elseif minetest.get_item_group(n.name, "grass_block") == 1 then + local grass_block_pos = {x = pos.x, y = pos.y + 1, z = pos.z} + bone_meal_particle(grass_block_pos) -- Grass Block: Generate tall grass and random flowers all over the place for i = -2, 2 do for j = -2, 2 do @@ -285,19 +314,24 @@ function mcl_dye.apply_bone_meal(pointed_thing) -- Double flowers: Drop corresponding item elseif n.name == "mcl_flowers:rose_bush" or n.name == "mcl_flowers:rose_bush_top" then + bone_meal_particle(pos) minetest.add_item(pos, "mcl_flowers:rose_bush") return true elseif n.name == "mcl_flowers:peony" or n.name == "mcl_flowers:peony_top" then + bone_meal_particle(pos) minetest.add_item(pos, "mcl_flowers:peony") return true elseif n.name == "mcl_flowers:lilac" or n.name == "mcl_flowers:lilac_top" then + bone_meal_particle(pos) minetest.add_item(pos, "mcl_flowers:lilac") return true elseif n.name == "mcl_flowers:sunflower" or n.name == "mcl_flowers:sunflower_top" then + bone_meal_particle(pos) minetest.add_item(pos, "mcl_flowers:sunflower") return true elseif n.name == "mcl_flowers:tallgrass" then + bone_meal_particle(pos) -- Tall Grass: Grow into double tallgrass local toppos = { x=pos.x, y=pos.y+1, z=pos.z } local topnode = minetest.get_node(toppos) @@ -308,6 +342,7 @@ function mcl_dye.apply_bone_meal(pointed_thing) end elseif n.name == "mcl_flowers:fern" then + bone_meal_particle(pos) -- Fern: Grow into large fern local toppos = { x=pos.x, y=pos.y+1, z=pos.z } local topnode = minetest.get_node(toppos)