summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/Core/onchunkgenerating.lua
blob: 4c97329bddaa4c5b8bd5ec9a6e500da05488e14b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function OnChunkGenerating(World, ChunkX, ChunkZ, ChunkDesc)
	if LimitWorld == true then
		SpawnX = math.floor(World:GetSpawnX() / 16)
		SpawnZ = math.floor(World:GetSpawnZ() / 16)
		if ( (SpawnX + LimitWorldWidth) < ChunkX ) or ( (SpawnX - LimitWorldWidth) > ChunkX ) then
			FillBlocks(World, ChunkX, ChunkZ, ChunkDesc)
		end
		if ( (SpawnZ + LimitWorldWidth) < ChunkZ ) or ( (SpawnZ - LimitWorldWidth) > ChunkZ ) then
			FillBlocks(World, ChunkX, ChunkZ, ChunkDesc)
		end
	end
end

function FillBlocks(World, ChunkX, ChunkZ, ChunkDesc)
	ChunkDesc:FillBlocks(0,0)
	ChunkDesc:SetUseDefaultBiomes(false)
	ChunkDesc:SetUseDefaultHeight(false)
	ChunkDesc:SetUseDefaultComposition(false)
	ChunkDesc:SetUseDefaultStructures(false)
	ChunkDesc:SetUseDefaultFinish(false)
end