-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Description
I tried running the example code on the Introduction page of the wiki, but it doesn't compile against the latest version of the source code. I tried changing it to this:
public static void Replace(string pathToWorld, int oldid, int newid)
{
NbtWorld world = BetaWorld.Open(pathToWorld);
var chunkManager = world.GetChunkManager();
System.Diagnostics.Debug.WriteLine("Num chunks: " + chunkManager.Count());
foreach (ChunkRef chunk in chunkManager)
{
// Process Chunk
for (int y = 0; y <= 127; y++)
{
for (int x = 0; x <= 15; x++)
{
for (int z = 0; z <= 15; z++)
{
// Attempt to replace block
int oldBlock = chunk.Blocks.GetID(x, y, z);
if (oldBlock == oldid)
{
chunk.Blocks.SetID(x, y, z, newid);
chunk.Blocks.SetData(x, y, z, 0);
// TileEntity consistency is implicitly maintained
}
}
}
}
// Save after each chunk so we can release unneeded chunks back to the system
chunkManager.Save();
}
}
But there are 0 chunks in the ChunkManager when I run it on "Substrate\Substrate.Tests\Data\1_9_2-debug".
Metadata
Metadata
Assignees
Labels
No labels