forked from mirrors/NBTExplorer
Fixed bug where empty chunks below the heightmap were not written.
This commit is contained in:
parent
baa01d6813
commit
719a969310
1 changed files with 11 additions and 1 deletions
|
@ -304,6 +304,16 @@ namespace Substrate
|
||||||
return LoadTree(tree);
|
return LoadTree(tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool ShouldIncludeSection (AnvilSection section)
|
||||||
|
{
|
||||||
|
int y = (section.Y + 1) * section.Blocks.YDim;
|
||||||
|
for (int i = 0; i < _heightMap.Length; i++)
|
||||||
|
if (_heightMap[i] > y)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return !section.CheckEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
public TagNode BuildTree ()
|
public TagNode BuildTree ()
|
||||||
{
|
{
|
||||||
TagNodeCompound level = _tree.Root["Level"] as TagNodeCompound;
|
TagNodeCompound level = _tree.Root["Level"] as TagNodeCompound;
|
||||||
|
@ -313,7 +323,7 @@ namespace Substrate
|
||||||
|
|
||||||
TagNodeList sections = new TagNodeList(TagType.TAG_COMPOUND);
|
TagNodeList sections = new TagNodeList(TagType.TAG_COMPOUND);
|
||||||
for (int i = 0; i < _sections.Length; i++)
|
for (int i = 0; i < _sections.Length; i++)
|
||||||
if (!_sections[i].CheckEmpty())
|
if (ShouldIncludeSection(_sections[i]))
|
||||||
sections.Add(_sections[i].BuildTree());
|
sections.Add(_sections[i].BuildTree());
|
||||||
|
|
||||||
levelCopy["Sections"] = sections;
|
levelCopy["Sections"] = sections;
|
||||||
|
|
Loading…
Reference in a new issue