-- -------------------------------------------------------------- --
-- DECORATIONS
-- -------------------------------------------------------------- --

-- Kelp
minetest.register_decoration({
    name = "vox_core:kelp",
    deco_type = "simple",
    place_on = {"vox_core:sand"},
    place_offset_y = -1,
    sidelen = 16,
    noise_params = {
        offset = -0.04,
        scale = 0.1,
        spread = {x = 200, y = 200, z = 200},
        seed = 87112,
        octaves = 3,
        persist = 0.7
    },
    biomes = {"ocean"},
    y_max = 0,  -- Ensure kelp can be placed up to ocean level
    y_min = -10,
    flags = "force_placement",
    decoration = "vox_core:kelp",
    param2 = 48,
    param2_max = 96,
})

-- Apple Tree
minetest.register_decoration({
    name = "vox_core:apple_tree",
    deco_type = "schematic",
    place_on = {"vox_core:dirt_with_grass"},
    sidelen = 16,
    fill_ratio = 0.02,
    biomes = {"grassland"},
    y_max = 31000,
    y_min = 1,
    schematic = minetest.get_modpath("vox_core") .. "/schematics/apple_tree.mts",
    flags = "place_center_x, place_center_z",
    rotation = "random",
})

-- Jungle Tree
minetest.register_decoration({
    name = "vox_core:jungle_tree",
    deco_type = "schematic",
    place_on = {"vox_core:dirt_with_rainforest_litter"},
    sidelen = 16,
    fill_ratio = 0.02,
    biomes = {"rainforest"},
    y_max = 31000,
    y_min = 1,
    schematic = minetest.get_modpath("vox_core") .. "/schematics/jungle_tree.mts",
    flags = "place_center_x, place_center_z",
    rotation = "random",
})

-- Pine Tree
minetest.register_decoration({
    name = "vox_core:pine_tree",
    deco_type = "schematic",
    place_on = {"vox_core:dirt_with_snow"},
    sidelen = 16,
    fill_ratio = 0.02,
    biomes = {"taiga"},
    y_max = 31000,
    y_min = 1,
    schematic = minetest.get_modpath("vox_core") .. "/schematics/pine_tree.mts",
    flags = "place_center_x, place_center_z",
    rotation = "random",
})

-- Acacia Tree
minetest.register_decoration({
    name = "vox_core:acacia_tree",
    deco_type = "schematic",
    place_on = {"vox_core:dry_dirt"},
    sidelen = 16,
    fill_ratio = 0.02,
    biomes = {"savanna"},
    y_max = 31000,
    y_min = 1,
    schematic = minetest.get_modpath("vox_core") .. "/schematics/acacia_tree.mts",
    flags = "place_center_x, place_center_z",
    rotation = "random",
})

-- Aspen Tree
minetest.register_decoration({
    name = "vox_core:aspen_tree",
    deco_type = "schematic",
    place_on = {"vox_core:dirt_with_grass"},
    sidelen = 16,
    fill_ratio = 0.02,
    biomes = {"deciduous_forest"},
    y_max = 31000,
    y_min = 1,
    schematic = minetest.get_modpath("vox_core") .. "/schematics/aspen_tree.mts",
    flags = "place_center_x, place_center_z",
    rotation = "random",
})

-- Grass
for i = 1, 5 do
    minetest.register_decoration({
        name = "vox_core:grass_" .. i,
        deco_type = "simple",
        place_on = {"vox_core:dirt_with_grass"},
        sidelen = 16,
        noise_params = {
            offset = -0.03,
            scale = 0.09,
            spread = {x = 100, y = 100, z = 100},
            seed = 329,
            octaves = 3,
            persist = 0.6
        },
        biomes = {"grassland"},
        y_max = 31000,
        y_min = 1,
        decoration = "vox_core:grass_" .. i,
    })
end

-- Dry Grass
for i = 1, 5 do
    minetest.register_decoration({
        name = "vox_core:dry_grass_" .. i,
        deco_type = "simple",
        place_on = {"vox_core:dry_dirt"},
        sidelen = 16,
        noise_params = {
            offset = 0.01,
            scale = 0.05,
            spread = {x = 100, y = 100, z = 100},
            seed = 329,
            octaves = 3,
            persist = 0.6
        },
        biomes = {"savanna"},
        y_max = 31000,
        y_min = 1,
        decoration = "vox_core:dry_grass_" .. i,
    })
end

-- Fern
for i = 1, 3 do
    minetest.register_decoration({
        name = "vox_core:fern_" .. i,
        deco_type = "simple",
        place_on = {"vox_core:dirt_with_grass"},
        sidelen = 16,
        noise_params = {
            offset = 0,
            scale = 0.06,
            spread = {x = 100, y = 100, z = 100},
            seed = 329,
            octaves = 3,
            persist = 0.6
        },
        biomes = {"grassland"},
        y_max = 31000,
        y_min = 1,
        decoration = "vox_core:fern_" .. i,
    })
end

-- Marram Grass
for i = 1, 3 do
    minetest.register_decoration({
        name = "vox_core:marram_grass_" .. i,
        deco_type = "simple",
        place_on = {"vox_core:sand"},
        sidelen = 16,
        noise_params = {
            offset = 0,
            scale = 0.06,
            spread = {x = 100, y = 100, z = 100},
            seed = 329,
            octaves = 3,
            persist = 0.6
        },
        biomes = {"beach"},
        y_max = 31000,
        y_min = 1,
        decoration = "vox_core:marram_grass_" .. i,
    })
end

-- Cactus
minetest.register_decoration({
    name = "vox_core:cactus",
    deco_type = "schematic",
    place_on = {"vox_core:desert_sand"},
    sidelen = 16,
    fill_ratio = 0.02,
    biomes = {"desert"},
    y_max = 31000,
    y_min = 1,
    schematic = minetest.get_modpath("vox_core") .. "/schematics/cactus.mts",
    flags = "place_center_x, place_center_z",
    rotation = "random",
})

-- Large Cactus Seedling
minetest.register_decoration({
    name = "vox_core:large_cactus_seedling",
    deco_type = "simple",
    place_on = {"vox_core:desert_sand"},
    sidelen = 16,
    noise_params = {
        offset = 0,
        scale = 0.06,
        spread = {x = 100, y = 100, z = 100},
        seed = 329,
        octaves = 3,
        persist = 0.6
    },
    biomes = {"desert"},
    y_max = 31000,
    y_min = 1,
    decoration = "vox_core:large_cactus_seedling",
})

-- Papyrus
minetest.register_decoration({
    name = "vox_core:papyrus",
    deco_type = "schematic",
    place_on = {"vox_core:dirt"},
    sidelen = 16,
    fill_ratio = 0.02,
    biomes = {"swamp"},
    y_max = 31000,
    y_min = 1,
    schematic = minetest.get_modpath("vox_core") .. "/schematics/papyrus.mts",
    flags = "place_center_x, place_center_z",
    rotation = "random",
})

-- Dry Shrub
minetest.register_decoration({
    name = "vox_core:dry_shrub",
    deco_type = "simple",
    place_on = {"vox_core:desert_sand"},
    sidelen = 16,
    noise_params = {
        offset = 0,
        scale = 0.06,
        spread = {x = 100, y = 100, z = 100},
        seed = 329,
        octaves = 3,
        persist = 0.6
    },
    biomes = {"desert"},
    y_max = 31000,
    y_min = 1,
    decoration = "vox_core:dry_shrub",
})

-- Jungle Grass
minetest.register_decoration({
    name = "vox_core:junglegrass",
    deco_type = "simple",
    place_on = {"vox_core:dirt_with_rainforest_litter"},
    sidelen = 16,
    noise_params = {
        offset = 0,
        scale = 0.06,
        spread = {x = 100, y = 100, z = 100},
        seed = 329,
        octaves = 3,
        persist = 0.6
    },
    biomes = {"rainforest"},
    y_max = 31000,
    y_min = 1,
    decoration = "vox_core:junglegrass",
})