Update grass color after placing grass block

This commit is contained in:
Wuzzy 2019-12-13 14:18:35 +01:00
parent 325801efd7
commit 9c55b6c9c9
2 changed files with 7 additions and 4 deletions

View File

@ -639,7 +639,7 @@ end
local grass_spread_randomizer = PseudoRandom(minetest.get_mapgen_setting("seed"))
-- Return appropriate grass block node for pos. Dry grass for dry/hot biomes, normal grass otherwise.
-- Return appropriate grass block node for pos
function mcl_core.get_grass_block_type(pos)
local biome_data = minetest.get_biome_data(pos)
local dry = false

View File

@ -326,10 +326,13 @@ minetest.register_node("mcl_core:dirt_with_grass", {
footstep = {name="default_grass_footstep", gain=0.4},
}),
on_construct = function(pos)
local node = minetest.get_node(pos)
if node.param2 == 0 then
local new_node = mcl_core.get_grass_block_type(pos)
if new_node.name ~= "mcl_core:dirt_with_grass" then
if new_node.param2 ~= 0 or new_node.name ~= "mcl_core:dirt_with_grass" then
minetest.set_node(pos, new_node)
end
end
return mcl_core.on_snowable_construct(pos)
end,
_mcl_snowed = "mcl_core:dirt_with_grass_snow",