1
0
Fork 0

Merge pull request 'Several fixes for applying bone meal to grass (Fix #900)' (#1894) from NO11/MineClone2:bone_meal into master

Reviewed-on: MineClone2/MineClone2#1894
This commit is contained in:
NO11 2021-11-12 15:02:30 +00:00
commit f233fb5d30
1 changed files with 27 additions and 26 deletions

View File

@ -288,16 +288,16 @@ local function apply_bone_meal(pointed_thing)
return true
elseif minetest.get_item_group(n.name, "grass_block") == 1 then
-- Grass Block: Generate tall grass and random flowers all over the place
for i = -2, 2 do
for j = -2, 2 do
pos = pointed_thing.above
pos = {x=pos.x+i, y=pos.y, z=pos.z+j}
for i = -7, 7 do
for j = -7, 7 do
for y = -1, 1 do
pos = vector.offset(pointed_thing.above, i, y, j)
n = minetest.get_node(pos)
local n2 = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
local n2 = minetest.get_node(vector.offset(pos, 0, -1, 0))
if n.name ~= "" and n.name == "air" and (minetest.get_item_group(n2.name, "grass_block_no_snow") == 1) then
-- Randomly generate flowers, tall grass or nothing
if math.random(1,100) <= 90 then
if math.random(1, 100) <= 90 / ((math.abs(i) + math.abs(j)) / 2)then
-- 90% tall grass, 10% flower
mcl_dye.add_bone_meal_particle(pos, {amount = 4})
if math.random(1,100) <= 90 then
@ -325,6 +325,7 @@ local function apply_bone_meal(pointed_thing)
end
end
end
end
return true
-- Double flowers: Drop corresponding item