There are a few ways to go about this, and since mgv7 is not stable at the minute, I'll take the more catch-all approach. Lua Voxel Manipulator is the short answer. There are two ways to make forests via LVM:
1. Have it spawn special saplings that grow via abm 1 second after chunk gen, by placing premade schematics of the trees (save them with WorldEdit).
2. Have it use functions to procedurally generate the trees.
That there is the heart of it. You will also need to implement a simple for loop to search for the ground level at any given area, and see if it is of suitable material (e.g. default:dirt_with_grass). A small example could be like this:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
--make variables to condense the edges of the generated chunk
local x0 = minp.x
local x1 = maxp.x
local y0 = minp.y
local y1 = maxp.y
local z0 = minp.z
local z1 = maxp.z
--loop through the x and z planes first
for x = x0, x1 do
for z = z0, z1 do
--loop from the top to the bottom, and stop when the node isn't ground.
for y = y1, y0, -1 do
local vi = area:get_data(x,y,z)
if data[vi] ~= c_air then
--grab the index of y+1, place your tree generator or else call your function to gen the tree. break afterward.
end
end
end
end
Just a very rough idea. I left out the bits about initializing the LVM and closing it down, look at either paramat or my own mods to get an idea how to start and stop them.
Nam ex spatio, omnes res venire possunt.
Why let the ground limit you when you can reach for the sky?
Back to college now, yay for sophomore year schedules. :P