Several fixes for applying bone meal to grass

This commit is contained in:
NO11 2021-11-10 17:15:27 +00:00
parent fafa47d643
commit 8979230c42

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