From 9c55b6c9c992c837b2c4329fbddf67fbe08e646f Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 13 Dec 2019 14:18:35 +0100 Subject: [PATCH] Update grass color after placing grass block --- mods/ITEMS/mcl_core/functions.lua | 2 +- mods/ITEMS/mcl_core/nodes_base.lua | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index 0d08c340..b4d7c6f0 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -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 diff --git a/mods/ITEMS/mcl_core/nodes_base.lua b/mods/ITEMS/mcl_core/nodes_base.lua index eb56b379..ca350579 100644 --- a/mods/ITEMS/mcl_core/nodes_base.lua +++ b/mods/ITEMS/mcl_core/nodes_base.lua @@ -326,9 +326,12 @@ minetest.register_node("mcl_core:dirt_with_grass", { footstep = {name="default_grass_footstep", gain=0.4}, }), on_construct = function(pos) - local new_node = mcl_core.get_grass_block_type(pos) - if new_node.name ~= "mcl_core:dirt_with_grass" then - minetest.set_node(pos, new_node) + local node = minetest.get_node(pos) + if node.param2 == 0 then + local new_node = mcl_core.get_grass_block_type(pos) + 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,