diff --git a/src/mapgen/biome_plains.lua b/src/mapgen/biome_plains.lua index 87a2dbf..d6b9b48 100644 --- a/src/mapgen/biome_plains.lua +++ b/src/mapgen/biome_plains.lua @@ -18,29 +18,30 @@ local chorus_plant = mcl_better_end.mapgen.registered_nodes.plains_chorus_plant local chorus_plant_top = mcl_better_end.mapgen.registered_nodes.plains_chorus_flower_dead -local function grow_chorus_branch(pos, height, pr, data, area, noise_map) +local function grow_chorus_branch(pos, height, pr, data, area, noise_map, lx,ly,lz) local current_pos = {x = pos.x, y = pos.y, z = pos.z} for i = 0, height do - current_pos.y = current_pos.y + 1 - local vi = area:index(current_pos.x, current_pos.y, current_pos.z) + y = y + 1 + if ly+y > 80 or ly-y < 0 or lz+z > 80 or lz-z < 0 or lz+z > 80 or lz-z < 0 then break end + local vi = area:index(pos.x+x, pos.y+y, pos.z+z) data[vi] = chorus_plant -- Randomly decide if we branch if pr:next(1, 2) == 1 then local branch_dir = pr:next(1, 4) local branch_pos - local noise = noise_map[current_pos.x][current_pos.y][current_pos.z] + local noise = noise_map[x][y][z] if not mcl_better_end.api.is_free(noise) then return end if branch_dir == 1 then - branch_pos = {x = current_pos.x + 1, y = current_pos.y, z = current_pos.z} + branch_pos = {x = x + 1, y = y, z = z} elseif branch_dir == 2 then - branch_pos = {x = current_pos.x - 1, y = current_pos.y, z = current_pos.z} + branch_pos = {x = x - 1, y = y, z = z} elseif branch_dir == 3 then - branch_pos = {x = current_pos.x, y = current_pos.y, z = current_pos.z + 1} + branch_pos = {x = x, y = y, z = z + 1} else - branch_pos = {x = current_pos.x, y = current_pos.y, z = current_pos.z - 1} + branch_pos = {x = x, y = y, z = z - 1} end local vi = area:index(branch_pos.x, branch_pos.y, branch_pos.z) @@ -51,7 +52,9 @@ local function grow_chorus_branch(pos, height, pr, data, area, noise_map) local vi = area:index(branch_pos.x, branch_pos.y + 1, branch_pos.z) data[vi] = chorus_plant_top end - current_pos = branch_pos + y = branch_pos.y + x = branch_pos.x + z = branch_pos.z end end local vi = area:index(current_pos.x, current_pos.y, current_pos.z) @@ -85,7 +88,7 @@ mcl_better_end.api.register_biome({ elseif pr:next(1, 100) == 5 then data[vi] = mcl_better_end.mapgen.registered_nodes.end_stone - grow_chorus_branch({x = x, y = y, z = z}, pr:next(1, 80-ly), pr, data, area, noise_map) + grow_chorus_branch({x = x, y = y, z = z}, pr:next(1, 20), pr, data, area, noise_map) elseif pr:next(1, 200) == 46 then if not mcl_better_end.api.is_island(plnoise_1) then