local S = core.get_translator(core.get_current_modname());
local dp = natural_habitat.dupes;

if not dp.rafflesia then
    dp.rafflesia = "natural_habitat:rafflesia";
    
    core.register_node(dp.rafflesia, {
        description = S("Rafflesia"),
        drawtype = "mesh",
        mesh = "nbt_flower_rafflesia.obj",
        tiles = { "nbt_flower_rafflesia.png", },
        use_texture_alpha = "clip",
        paramtype = "light",
        paramtype2 = "facedir",
        selection_box = {type = "fixed", fixed = {{-0.4, -0.5, -0.3, 0.4, 0.4, 0.5}}},
        collision_box = {type = "fixed", fixed = {
            {-0.4, 0, 0.1, 0.4, 0.2, 0.5},
            {-0.4, -0.5, -0.3, 0.4, 0, 0.5},
        }},
        groups = m7a.impact(
            { snappy=3, flower=1, flora=1, attached_node=1 },
            {
                ["mineclonia"] = {
                    handy = 1, hoey = 1, shearsy = 1, swordy = 1, dig_by_piston = 1,
                    deco_block = 1, plant=1, flower=1, non_mycelium_plant=1,
                    flammable = 2, fire_encouragement = 30, fire_flammability = 60,
                    compostability = 30, unsticky = 1
                },
            }
        ),
        walkable = true,
        sounds = natural_habitat.sound_leaves(),
        sunlight_propagates = true,
        on_place = function(itemstack, placer, pointed_thing)
            return m7a.place_item(itemstack, placer, pointed_thing).itemstack;
        end,
        
        _mcl_hardness = 1,
    });
    
    core.register_decoration({
        deco_type = "simple",
        decoration = dp.rafflesia,
        place_on = {
            dp.soil, dp.soil_with_grass, dp.rainforest_litter,
        },
        fill_ratio = 0.001,
        biomes = { dp.biomes.rainforest, dp.biomes.jungle },
        spawn_by = "air",
        num_spawn_by = 1,
        y_min = 5,
        y_max = 31000,
    });
end;